how to run app forever in background like whatsapp ?
I need when app is killed receive notifications.
I tried many way to this.But still not wrk.
I have no idea.
Kindly advice me,
Thanks
how to run app forever in background like whatsapp ?
I need when app is killed receive notifications.
I tried many way to this.But still not wrk.
I have no idea.
Kindly advice me,
Thanks
how to run app forever in background like whatsapp?
App will be running forever in backgroung unless it is killed explicitly.
Even for Whatsapp if you kill it by pressing Force Stop button in Settings->Apps->Whatsapp
, It can't receive any notifications unless you start it manually by opening the app. Also if the app is configured to Block all the notifications (in Settings->Apps->YourAPP->Notifications->Block all
) then it won't receive any notifications.
I need when app is killed receive notifications.
Yes. The app can recieve notifications when it is in background(not forcefully stopped). In cordova I assume you are using phonegap-plugin-push for receiving notifications. The on.notification()
event handler function will be called when notification is recieved.
Two cases when the app is running -
on.notification()
event handler function will be called by default.on.notification()
event handler function will not be called by default. You need to set "content-available" : "1"
in the data field while pushing notifications. And you cannot do this using Firebase Console. You need to have custom payload servers for pushing notifications.Refer this answer for sending custom payload messages using PHP and NodeJS.