简体   繁体   中英

Push data from Java RESTful server to Android phone for notification

I have been doing some research on what the easiest way to get phone PUSH notifications from a server would be, and so far I have found C2DM, TCP socket connection, and SMS messaging.

MY main issue is telling which is going to be easiest with my Java RESTful service connected to a mysql database. Basically my intent is to use a sensor that is writing data to my database everytime it is triggered, and once this data is placed into the database, I want it to be sent to my Android phone as a PUSHED notification.

If anyone can point me in the right direction that would be great, I have a project due in a few weeks so I need to start in a direction that I know will work rather than testing these techniques out with trial and error. Also I am developing for JellyBean.

Thank you!

Well your best bet is certainly GCM (the new and improved C2DM). You can find specifics about getting started with your Android project here

As your your server implementation, here are some helpful parts of the google doc: Server API stuff and Sample Server Implementation and A PHP Example

Depending on what your server side language is, this might help. If not let me know and I can give more examples

I always use C2DM and im happy with it. Since c2dm is integrated in android i think you cant find a android based solution with fewer battery consumption and sended bytes. It is also very easy to integrate. The drawback of this solution is, that it is only usable for android but that should not be the point since there are other good and simple solutions for other platforms and the implementation overhead is small because the c2dm solution is so easy to integrate.

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