Red-Folder / bgs-core

Core code for the Cordova Background Service
Other
236 stars 105 forks source link

Does this plugin works with local notifications? #104

Closed fasma89 closed 5 years ago

fasma89 commented 5 years ago

Hello , i have created an app with phonegap , and i need to get local notifications every time a new lesson arrives. Does this plugin work even if the application is closed, or in order to get notifications ,application has to run all the time in background??

Red-Folder commented 5 years ago

If you want to push notifications to your users, you are probably better looking at something like this -> https://firebase.google.com/docs/cloud-messaging/

With the above; you would "push" updates out to registered customers

I assume that you're current plan is to have an "always running" background service which polls a server for new content - then raise a notification.

The Android team have done a lot of work to discourage that approach as having "always running" services can be very battery & network intensive. They apply limitations on the developer to try and protect the user experience - more can be found here -> https://developer.android.com/about/versions/oreo/background

Based on what you have put, I'd suggest looking at the cloud messaging above. An alternative maybe looking at the Job Scheduler (https://developer.android.com/topic/performance/scheduling)

Personally I wouldn't use this plugin for the purpose as you will be fighting the limitation imposed by the Android system. Technically it is probably possible with work - but not advised.

fasma89 commented 5 years ago

Thanks for the response ! So how applications like messenger works all the time when a new message arrives for example?