简体   繁体   中英

How can I create an Android notification from Phonegap?

what I want to make is a notification from Phonegap, I want to launch this from a request made in polling via js to a page that returns a JSON, after the call end I want to parse the JSON and launch the Android notification. The application have to run in background.

Do you have any suggestions?

Thanks in advance!

You may also want to consider Google's C2DM (Cloud to device messaging) to do a push notification. You could push your json to your app, parse it and then create the notification you want. This will avoid needing to implement polling on the device and killing battery life if done properly.

https://github.com/awysocki/C2DM-PhoneGap

Check this notification plugin which might work for you need:

Statusbar Notification Plugin

For The application have to run in background you might want to look in these posts:

How can I tell if Android app is running in the foreground?

or

How to detect if any of my activity is front-most and visible to user?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM