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.
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
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.
Related
What i did is :
I have used JobScheduler. In every two hours, it checks weather there is a new data available or not in Server->Database->Table. If new data available it retrieves the data and notifies to the subscriber.
Kindly any one suggest me weather this is right approach or not?
Is there any other way to do so?
Can I implement PUB/SUB concept here..
If yes, How?
I am using Godaddy Hosing..
No,its not a good way
You may try like this
1) Integrate FCM Push notification at Backend side(PHP etc)
2) Take Legacy Server Key for Push notification from Firebase
3) Wherever you will get update of data send notification using Device Token
4)at app side you need to add code for handle push notification
for more help refer this URL
I am developing a custom chat application.
Sent messages are stored on my server using a simple POST.
A service that runs in background is responsible to check using another POST every 5 seconds if there are new messages for the current user and send a notification to the him/her.
I am a bit worried about network and CPU usages because i am aware that internet connection is used all the day.
I used that approach because i need to manipulate some data on my server code before delivery a notification to receiver.
An example is that i have some users assigned as admin. The users username is their email. When a message is sent from one of the admins i overwrite their username (so their email) with the application name before delivery the notification to the receiver.
Is this the best approach to create a custom chat application?
Dont know exactly why you used this use case, but really simple solution provides Firebase.
You can read something about that here. Basically you have to:
Create some layouts
Add listener on "send message" click, that will add message to firebase realtime database
Create FirebaseListAdapter, who will display messages to user
From database docs
all of your clients share one Realtime Database instance and
automatically receive updates with the newest data.
From my understading you dont have to check every 5 seconds if there is some message waiting. Firebase handles it for you.
Everyone....!!
Greetings..!!
I am working on XMPP based Chat app . I have used XMPPFramework by Robbie Hanson https://github.com/robbiehanson/XMPPFramework
i have used OpenFire as XMPP Server
I am facing problem to get Push Notification for Group Chat when user is offline.
Currently I am able to get Push Notification for One to One Chat when user is offline . (For this I have created a PHP WebService which fetches the information from ofOffline Table every 60 sec)
But As there are no Offline messages Tables for Group Chat.
Can anyone suggest me How can I get push notification to group when user is offline in group
I need to manage this from Both Android n iOS Chat App
for Android i am using
https://github.com/siacs/Conversations
Look into ejabberd_mod_offline_post
First config the Room must be a Member-Only room, and add all users as members right after you created it, so that be able to get a total.
Add above model into ejabberd models.
Implement a Callback Service to handle the callback post.
The idea is when User go offline
In one-to-one case, offline_message_hook will be raised
In MUC case, muc_filter_message will be raised, and any one not Presence-Available is offline.
The best example would be AMP implementation in the Tigase. It is based on a MessageAmp plugin and AMP component.
The MessageAmp plugin intercepts messages. If it detects that the user is not logged in, it forwards the message to AMP component to store it in an offline storage. In your case, you could have your own Message plugin which, if it detects that the user is offline, could forward the message to your Push component (iOS push or Android push, SMS push or something else).
And all the logic responsible for actual pushing notification to the device should be implemented in that component.
Try checking this MUC - Light and use the mod_zeropush module to modify a bit to handle single and group push from the muc-light.
Its more like whats app , although you may not achieve 100% results as you expect but less complex than the tradition XEP-0045.
How to load chat history message in android without using local storage? My doubt is, I am getting chat history messages from a service and I am loading it to a list. But if any other person chat at that time I am getting that message in that list itself, how to segregate that message from other person chat? Like how they have done in Google talk.
It is hard to give you an appropriate answer without further details:
1) How is the service passing data to your UI? (Cursor, Object Oriented Domain Model)
2) From where are those Chat Messages coming? If it is a online service, is offline caching really no option?
Code snippets are also helping to clarify the situation.
Its some complex, see
when you opening chat screen, just save userId(id of that friend with which you are chating) in prefrences, so when you receive new message in onMessage() method of GCMIntentService class then compare userId(coming with message) with userId(you saved in preferences), if id matched you do not need to call generate notification method, just simply show message in your chat list, if id does not matched, then call to generate notification method(as currently happening), and does not put message in chat list.
HOW I TRIED:
I have a scenario in which teacher would upload an assignment alert on the server with following thing:
Title
Description
Downloadable Links
created date
Deadline
and the student would get these detail on an Android. I have done this work (the communication between server and client side using WCF webservices). All the data is showing in the ListView on client Side which are uploaded on the server.
WHAT I WANT
A push notification of that alerts on a particular dates e.g (if the teacher uploads an alert on 14 April then the user on the client side would get a push notification on the same date).
DealLine push notification of that alert on a particular dates e.g (the user would get a dealline notification of that assignment on a particular deal line)
I have studied about the GCM. is the best way to send a push notification on an android device. But I don;t think that the GCM is the appropriate solution of my problem? or I just simply go for the Android Notifications?
Does anyone suggest me the how can I do this work? Any appropriate solution for this, or I would have to use any third party library for this work? any tutorial that similar with this problem? THanks in Advance.