I have an Api. Suppose this api http://api.androidhive.info/contacts/ has this contact which I'm displaying in list view. I want to set a push notification in our application, such that when ever a new contact is added in the api then there should be a notification in our application that a new contact has been uploaded. This Notification should be displayed even if the application is not open or launched.
For example: It should function like "Time of INDIA" android app. When news updates come then it shows a Notification.
I am new in android. Please help me. hHw i will do this? Please send me example sources or post me related blog or tell me logic. How i will do this i have server access also.
Thanx
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
Related
I am creating a simple forum app for ANDROID using Parse. I am stuck at a problem related to notifications
For instance I want that when user A posts a comment in a forum app, user B (who subscribed to that post) will receive a push notification, can I do that using either client code, instead of handling it using Cloud Code, or the REST API? If not then how to I start developing the server side to use cloud code or REST API
Allowing users to send push notifications via the client is bad for security reasons. It's not incredibly difficult to get the application id and client key to an app. Anyone with that information will be able to create their own code that allows them to target whoever they want with push notifications if client push is enabled.
So i'm working on a summer project to create my first android app. Here's the basic idea: It's a workout app where a user goes to a website and submit's a text form of a workout. This app will then parse the text file format it onto an android app they can take to the gym.
So far I just have some classes written in java to hold the workouts and an html website. How would I go about sending the text from the website to the app? If you could point me in the right direction or give me some examples of how this is done that would be great.
You could use the GREAT Google Cloud Messaging System as the backbone for your applications.
Google Cloud Messaging (GCM) is a free service that enables developers
to send downstream messages (from servers to GCM-enabled client apps),
and upstream messages (from the GCM-enabled client apps to servers).
This could be a lightweight message telling the client app that there
is new data to be fetched from the server (for instance, a "new email"
notification informing the app that it is out of sync with the back
end), 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 and from the target client app.
Work flow of the GCM
Check this example
This question already has answers here:
How to make a chat application in android? [closed]
(6 answers)
Closed 9 years ago.
I am developing an Android app in which I have to implement chat messaging. I would like one to one chat or a group chat.
But I have no idea how to start. Please help me with this stuff. Any help will be appreciated.
A simple chat mechanism will have 2 basic functionalities
Send the message to server (with info about the recipient)
Receive the message from server (designated for my user name)
First step is simple, we can create a web service which will accept the message with additional information about recipient(s). We can create it using any server side language.
Step 2, that is fetching the message from server can be done using 2 techniques, Pull the message (using polling) from server, or Push the message from server to android phone
Polling: In this, the android device will keep accessing server after a few seconds to check if there is a message available for user. This again can be implemented using a simple async task at the client side which will keep calling a web service after say 2-3 seconds. This is fine to use if we are planning to enable chatting only when user is accessing the app (no notifications like gmail or facebook), so that we can kill the polling service when not in use (otherwise it will eat up resources).
Push notifications: a better option is to use push notifications. Android provide Google cloud messaging or GCM (http://developer.android.com/google/gcm/index.html) which will help achieve push from server easily. Otherwise you can try a third party API like urbanairship or pushwoosh depending on your requirement. Push notifications will help the user to receive messages even when he is not using the app.
So in nutshell, a webservice to receive the messages and a push notification mechanism should be sufficient to implement a chat service in android.
Little bit about UrbanAirship
I used UA in one of my projects for push notifications as I needed to support both iOS and Android. If you just want to support Android GCM might also be a good option.
Coming back to UA, check this for sample code and usage: https://docs.urbanairship.com/display/DOCS/Home
The way it works is simple, when someone installs the app and is connected to internet, app registers itself to the UA service. A unique code is specified for each installed app (this is the time when you can capture the user name and unique code and store somewhere in your DB). Next UA provides an API using which you can push a message to designated recipient(s), using the unique codes which are available with UA. These messages can be received by android app and used as per the requirement. Even if the app is not running we can show a notification just like when we receive an email or a message
You can use an existing platform like Scringo. It gives you a one-on-one chat as well as group chat (both the client and the server) as well as the push notification service.
I am developing android application that would receive data from server any time.i have searched in google to get some information.
1)android cloud to device messaging(C2DM).
2)persistent TCP/IP connection.
how to implement C2DM function and other one how to register C2DM?.please explain detail and send me sample application
C2DM is deprecated and you can use GCM for your requirement
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
c2dm is deprecated.
https://developers.google.com/android/c2dm
Maybe you'd better start with GCM
best regards
I've built an phone gap application for android which is now on my website. From time to time, I make updates to it, and I'll like to make users know that a new version is available.
How can I send notification update to the users of the app? I also want as user accept the notification new version start downloading.
Does anyone have any advise?
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 this link,
http://developer.android.com/guide/google/gcm/gs.html
for client side app you can find the code here
https://github.com/marknutter/GCM-Cordova