react native cron job lib - reactjs

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

Related

CodenameOne API, how to customise Local Notification text

I think i've found a blocker in my app development that i hope you can help me out with please.I am using a CN1 Local Notification and i want them to be triggered at an interval at a particular time. The LocalNotification sample project works but please can you answer this. How can i code it so that each local notification text n.setAlertTitle() is customised\different each day, from reading from a List? All the examples i read have static text.
I had thought of not making it repeat but initiating a new notification upon the user clicking previous one, but this would have the problem that if the user ignores the notification then no more would be sent, so i abandoned that approach.
Many thanks in advance.
The solution is not to issue a recurring notification and instead register several separate notifications. You will need to store and manage the notification ID's so you can cancel and replace them.
In order to change the text dynamically your app needs to run and the basic idea of the notification is that it occurs while your app isn't running so it must be static.

Cordova Local notifications plugin not working after a while

I'm working on my 2nd app and having some problems implementing notifications.
It works when app in the foreground, and about 5 min after I put it to the background, even when the app is closed.
So the app listens for a firebase change and then launches;
cordova.plugins.notification.local.schedule
If the app doesn't respond after a while, I open it and it gives me the notifications
I used cordova.plugins.backgroundMode.enable(); to make the app run in the background, but no luck.
Any ideas or is there a better way to push notifications to your app?
For everybody still searching, You have to capsulate the code in a device.ready(), if not you'll run into this bug

Scheduling app in ionic which triggers functions after specified time

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.

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

How to update location in ionic from background?

So in my app i need to send my location's coordinates every 5 minutes through web service, I need to send it when app is in background state also. I am using background-geolocation plugin. Anyone please help me to do that. Thanks in advance
The other way running prcocess in background is by using android core if you know that.
I was also facing the problem of running process in background. I have installed the background plugin too. But it did not work. Then i wrote a customized code in android.
Steps i followed.
1.) Stored the data in cordova prefrences.
2.) Fetch the data from prefrences in android core file( a java file).
3.) Written service in android that check the prefrences after every 2 minutes.
I know this is quiet tuff but this was the only solution i got in hybrid app.

Resources