Tasnim M. Ankon
Tasnim M. Ankon

Reputation: 61

send and receive notifications in android

I am developing an app in android in Eclipse IDE. The app modality requires that any user can challenge his/her friend to do a certain activity. Whenever a user does so, the friend will immediately get a notification in his/her phone. Even more, the user who challenged the friend, will also receive a notification when the friend accepts the challenge. Is there any particular way I can provide this functionality? I know how to generate notifications. But the server side interaction is quite confusing. Should I check the server database through the app at frequent intervals and check for such activities in database? I think the procedure will hamper the performance of the app. I would be very grateful if anyone can suggest a good way.

Upvotes: 0

Views: 54

Answers (2)

Jejefcgb
Jejefcgb

Reputation: 390

It seems that you don't really need an interaction between the differents users but only a way to notify them. I always used Google Cloud Messaging to do so. It enables you to receive push notifications. As you said, checking the server periodically is battery/data consuming and not the best way to do it.

This link might help to set up GCM : http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/.

Upvotes: 0

malarres
malarres

Reputation: 2946

But the server side interaction is quite confusing.

As you're pointing out, it's the server part not the Android one what's confusing here. If you don't have any constraints on the server part, I'd recomend to use Socket.io http://socket.io/ They have a tutorial for connecting socket.io with Android: http://socket.io/blog/native-socket-io-and-android/

Upvotes: 1

Related Questions