Ionic Framework Lifecycle - angularjs

Is there Ionic application lifecycle like Android. I am asking this because I am developing an video application and while my application went background video still plays like android service or I push hardware backbutton video still plays.

Ionic framwork lets you develop the beautiful, hybrid mobile apps using open source front-end SDK and HTML5.
you can refer lifecycle events from http://ionicframework.com/docs/api/directive/ionView/.
even you can handle one from given event to stop application from running when application goes into background.
You need to handle pause event to stop executing till application again resumed. again at the time of resume you can use resume event to again initialize.

Related

Understanding Local Notification in Codename one

I implemented a local notification test per this example https://www.codenameone.com/blog/local-notifications.html
I have the following two questions:
1) can I test local notifications from CN1 simulator. In the link above, I see a local notification test screenshot using the iPhone 6 simulator. Is there a way to force the app to run in background form the simulator in CN1?
2) If a local notification is sent when the app is running in foreground, I understand that the notification will not fire. Is the message lost in this case or is it queued somewhere?
Currently you can only test this on the device, it will work in the native simulator for iOS as you saw in the screeshot. You can run on the native iOS simulator using a Mac and include source.
The message would be lost if you fire in the foreground on iOS as it's the assumption that this is something you can notify within your app more effectively. You can determine if your app is in the foreground using the Display.isMinimized() method. In the foreground case you can use a tool like ToastBar to show a notification.

hardware back button on Android is stopping the app

I making mp3 player with ionic. I use "cordova.plugins.backgroundMode.enable()" for play music in background if close the app.
But when press hardware back button on Android is "stopping and closing" the app instead of just "closing and go back".
You have to use something called Android Services.
From the docs:
"A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use."
Here's the excellent official guide to using services to get you started: http://developer.android.com/guide/components/services.html
Here's a good tutorial on building an audio player: http://www.androidhive.info/2012/03/android-building-audio-player-tutorial/
Here's a video tutorial for building a streaming music player: http://www.youtube.com/watch?v=LKL-efbiIAM

Is it possible to open a web page from a Cortana background app?

Cortana background apps provide deep linking capabilities, which allow the developer to link to a specific page within her app. I'm wondering if it's possible to open a different application instead, for example a web browser.
My current work-around is to deep-link into my app, and then call Windows.System.Launcher.launchUriAsync as soon as my app is launched. However, this means that the app opens along of the web browser. I would like it to not open at all! Is that possible?
From the MSDN page for LaunchUriAsync:
Unless you are calling this API from a Classic Windows application, this API must be called from within an ASTA thread (also known as a UI thread).
Unfortunately, Cortana's background task is not a UI thread. You're running as a background task, and communicating to Cortana's UI via a set of APIs provided for that purpose, which are limited by design.
Anything you try to do that requires you to be in the UI thread is going to fail for the same reason. You could try hosting the web control in your app however to remove the chain-launched browser from the equation.

How to play an alarm in WatchOS 2 when NSTimer is asleep?

Have a specialized timer I'm creating and have the NSTimer working fine, updating on wake, etc but can only get the haptic to play if the user has the app actually on the display. I realize there are no background apps, but looking at various ways to schedule the alert much like the native Timer app does for its simple timer.
NSTimer.ScheduledTimerWithTimeInterval does not fire if asleep, looking at local notifications (note this app needs to run without the iPhone present so unclear if this is possible) and perhaps presentAlertControllerWithTitle is the way to go but unclear how to schedule it.
This seems like a simple/typical ask but most of the timer tutorials online and the searching I've done ignore the fact the app goes to sleep or only handles the wake events to reset the timer appropriately.
With WatchOS 3.0 you can schedule UNNotificationRequest with a specified timeInterval to get notified that time out happened.
In watchOS 2 the only situation where your app will be launched in the background is when updating a complication. watchOS 2 doesn't offer any background modes.
watchOS 3 in the other hand extends background capabilities via Background App Refreshes (BAR) and if you're a Health&Fitness or a Mindfulness app you can start a workout session using HealthKit to continuously run on the background while your workout session is active.
Other then that the only way to accomplish what you need is via notifications. In watchOS 2 you need to use the WatchConnectivity framework to wake up your iOS app and schedule a notification on the phone (later on it will be routed to the watch if the phone is locked and the watch is being worn) or in watchOS 3 you can schedule local notifications that will only be presented on the watch via the UserNotifications.framework.
For more info, please check:
What's New in watchOS 3 (video)
Introduction to Notifications (video)
Watch Connectivity API reference
HKWorkoutSession API
UNNotifications API reference

Win 8.1 Universal app - App Exit on Fast App Switching

I am developing an app for Windows Universal 8.1, facing an issue where the App gets Exit on going background. The scenarios are as follows
When the app goes background on clicking Windows key(FAS), the app get exit.
When I launch Share Task i.e Data Transfer Manager Interface, after completing the share operation the app exit.
Works fine in Debug mode but issue found after deploying to the device.
PS : I am using the Navigation Service Interface to navigate to pages using MVVM and navigating from viewmodels.
Please help if its known issue, if not help to rectify this.
Thanks in advance.
Sounds like your App crashes in The Suspending Event. As apps in Debug mode are not suspended, you are unlikely to see that happen.
You can manually fire the event from Visual Studio when debugging: It is in the debugging toolbar under Application Lifecycle Events.
Most common error in this case: Using complex objects as navigation parameters, which cannot be serialized.

Resources