push notification in android application

2019-08-08 19:40发布

问题:

Hi i wish to implement push notification in my own android application. how can i do? please give me some ideas....

This kind of broadcast receivers should receive messages even if my app is closed(like Gmail.here i receive one new message in my inbox means that time the notification message is displayed on top of my android device,clicked that notification message means directly go to inbox and view that message).

here i wish to insert one data on my database means the notification message is display on my android app even my app is closed.

回答1:

Please see http://developer.android.com/guide/google/gcm/index.html. You need to implement GCM.

EDIT:

To get notification even if app is in background, see Android GCM (push notification): device doesn't receive notification if application is stopped.

See Android GCM basic implementation, http://developer.android.com/guide/google/gcm/demo.html & How to setup Google Cloud Messaging for Android?



回答2:

see http://developer.android.com/guide/google/gcm/index.html for detaily. There you find a tutorial and all the basic stuff