Closed ys27 closed 2 years ago
You can't do it using local notification but you can do it via remote notifications. You can use react-native-gcm-android
or react-native-push-notification
to receive remote notifications. The latter seems to be more stable. You will need to send the remote notification yourself though periodically.
I don't understand why this can't be achieved with local notifications. Is it just under-developed or programmatically not available? Thank you.
This is from my personal experience and I may be wrong. For local notifications, you can attach a handler which is called when the local notification is clicked which required user intervention. For remote notification, you can attach a handler which is called when a remote notification is received which is called as soon as the remote notification is received not requiring any user intervention. This is why I think remote notification may server your purpose. Yes, you can use some online services such as Batch to send remote notifications or you can setup your own server to send remote notifications. I have used node-gcm
package in my server implementation to send remote notifications.
I see. I just think it's an overshoot to have to set up a server for remote notifications for an app that just alters the database everyday and unreliable since it requires data, although it isnt likely for users to not have data, as far as I see. I would still like my app to be entirely local. I didnt know that the user clicking on the notification can call a handler which is definitely better than what I had. My only other plan was to use react-native-background-timer, whoch is having some problems with my usage right now.
I'm looking for a way to run functions at a certain time everyday. Could this be used for such usage?