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
Related
We integrated web push notifications in our React App with firebase, it is working fine both in foreground and in background. When the app is in foreground we attached a event listener (onMessage) that will handle the event and will create a push notification with the Notification Object. It is also working fine.
My question is, is there any way to increase the amount of time the notification (foreground notification) will be shown to the user? currently it is visible for 5 to 6 seconds (in Brave, Linux Mint).
Thanks in advance
No you cannot increase the time your notification is shown.
I am working on a react-native based mobile app using expo.
in the app the user can set schedules for medication reminders, for that I am using expo-notifications to show those reminders.
expo-notifications provides some functions to schedule notifications, but it is not that flexible.
schedules like every Sunday at 09:00am, or every 2 days at 05:00pm, daily at 08:30pm, and so on...
I need a library that helps in scheduling those reminder notifications, with the ability to cancel the scheduled notification.
My important thing is that the suggested library should work even if the app is backgrounded or killed.
Any other suggestions on how to make reminders that work even if the app is backgrounded or killed are appreciated.
I tried node-schedule but I found it works only if the app is in foreground.
thanks in advance
You can check out react-native-background-timer: https://github.com/ocetnik/react-native-background-timer
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.
I'm a newbie to Ionic app development and have a requirement for which I've mined the internet but in vain.
My requirement is as below:
The user can select a Time Period i.e say 3hrs from now, after this time period, a trigger will run within the app and will perform a certain function depending what the user has selected (like play music, send sms or email). I have my individual modules of code ready for playing music, sending sms or email.
I only need to know how to trigger those events in ionic.
The important part is that the trigger should work even when the app is closed, screen is locked and should also survive a reboot.
I've tried the following, http://www.gajotres.net/how-to-use-local-notifications-with-ionic-framework/ ,
https://github.com/wnyc/cordova-plugin-wakeuptimer ,
https://scotch.io/tutorials/build-a-real-time-scheduling-app-using-angularjs-and-firebase but could not meet my requirements and in Vain.
Please help me and guide me through this.
Thanks in Advance,
Thats not possible with ionic, as hack u can use local notification and schedule notification as per ur requirement, on tap u can call any other action.
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.