admin管理员组

文章数量:1336632

I am trying to develop an android app that verifies a transaction initiated from a browser on a PC. I want the server application to push a notification of a new transaction to the app so the user can confirm to plete the transaction. The tricky bit is the transaction is specific to a particular person (I'm using this as an alternative to sending an SMS for example). Can anyone help on how to go about this? Is it possible to do this with C2DM or GCM?

I am trying to develop an android app that verifies a transaction initiated from a browser on a PC. I want the server application to push a notification of a new transaction to the app so the user can confirm to plete the transaction. The tricky bit is the transaction is specific to a particular person (I'm using this as an alternative to sending an SMS for example). Can anyone help on how to go about this? Is it possible to do this with C2DM or GCM?

Share Improve this question asked Jul 17, 2013 at 11:01 georgegeorge 231 silver badge3 bronze badges 1
  • I want to pass a parameter from my server to the android app without showing it to the user in the notification. Any Ideas? – george Commented Jul 19, 2013 at 15:23
Add a ment  | 

2 Answers 2

Reset to default 4

Using Android GCM is advisable. The plete reference to GCM is available at

http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

Step by step GCM development is given in there. It is really very helpful. Hope this is helpful to you.

The critical thing you need to keep in mind before making a decision is that when you are using GCM, you need to keep a track of the users by keeping their GCM_ID in your database. You can add a gcm_id column to your users table for this and whenever the user opens your app, the gcm_id should be updated in your database. The gcm_id of the user's phone can change, from the official docs:

 Note that Google may periodically refresh the registration ID, so you should design your Android application with the understanding that the .google.android.c2dm.intent.REGISTRATION intent may be called multiple times

GCM push notifications wont be able to reach your users mobile phone all the time,especially if his phone is not connected to internet or switched off.You are using this for transactions etc, so I assume that the notifications must not fail. You should keep a check in your web application to send an SMS or notify the user that this has failed. You should get a response from GCM to your server through which you can identify a failed case.

本文标签: phpSend Push notification to specific UsersStack Overflow