user1676640
user1676640

Reputation: 635

push notification in android own app using soap webservice

i have developed successfully one listview using soap webservice.here i have to insert 2 item on my database means that time (2 new item is inserted) the notification message is automatically comes to the top, clicking the notification will take you directly to the app and display listview with the 2 new items also.it is perform even my app is closed also like gmail.in gmail got any new message means that time the notification message is displayed,clicked that notification message means directly go to inbox and view that message. How can i implement this.

Upvotes: 0

Views: 1665

Answers (2)

Milos Cuculovic
Milos Cuculovic

Reputation: 20223

SOAP Service messqges are get only when the device requests something from the server. If you would like to use SOAP, you need to request from the server if there is a new item each amount of time (which is not really good practice). Then, if a new item is there, you can request the item by SOAP and insert this item in your array list and refresh the table.

A nicer way of doing is to use GCM (Google Cloud Messaging for Android): http://developer.android.com/guide/google/gcm/index.html

There, you can create a server side app where you will notify your device whenever a new order is inserted. You have a method onMessage() wher you can handle the message and insert it in your list.

It depends of what do you want exactly, the question can be developped more in details.

Upvotes: 0

Bhavesh Patadiya
Bhavesh Patadiya

Reputation: 25830

you can use GCM for this,

Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device

This document describes how to write an Android application and the server-side logic, using the helper libraries (client and server) provided by GCM.

Check these links,

http://developer.android.com/guide/google/gcm/gs.html

http://developer.android.com/guide/google/gcm/demo.html

http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/19226-android-push-notification-gcm-framework-tutorial.html

http://fundroiding.wordpress.com/2012/06/29/google-cloud-messaging-for-android-gcm-simple-tutorial/

for client side app you can find the code here

https://github.com/marknutter/GCM-Cordova

Upvotes: 1

Related Questions