Professional Documents
Culture Documents
TECHNOLOGY
FOR
ANDROID
ABSTRACT
.
Google Cloud Messaging for Android (GCM) is a service that helps developers to send
data from servers to their Android applications on Android devices. The service was unveiled on
June 27, 2012, at Google I/O 2012 held at the Moscone Center in San Francisco. The GCM
service handles all aspects of queuing of messages and delivery to the target Android application
running on the target device. It is completely free whatever your messaging needs are and it can
be used in some applications like smart notification systems.
GCM in real world experiments, and at a reasonable scale involving thousands of real users.
Our findings reveal that the GCM message delivery is unpredictable, namely having a reliable
connection to Googles GCM servers on the client device does not guarantee a timely message
arrival. Therefore, GCM is not suitable for time sensitive and/or must-deliver-to-all app
scenarios. On the other hand, GCM delivers the push messages to a big portion of the subscribers
(more than 40% in any experiment scenario) in a reasonable timeframe (in 10
seconds).Therefore, GCM may be a good fit for the application scenarios where random
multicasting is sufficient, such as crowd sourcing systems.
INTRODUCTION
Google Cloud Messaging for Android (GCM) is a service that allows you to send data
from your server to the users' Android-powered device. This could be a lightweight message
telling your app there is new data to be fetched from the server like new version of apps or
something like that.
The GCM service handles all aspects of storing, queuing and delivery of messages to the
target Android application running on the target device. It is a completely free service whatever
your messaging needs are.
Google Cloud Messaging technology is the new version of the C2DM (cloud to device
messaging) technology as the C2DM service has been officially deprecated as of June 26, 2012
which means that C2DM has stopped accepting new users and quota requests. The GCM could
be considered as a more efficient implementation of the C2DM technology.
WHAT IS GCM?
Google Cloud Messaging (GCM) is a service that helps developers send data from
servers to android applications on Android devices. The service has the ability to send a
lightweight message informing the Android application of new data to be fetched from the
server.
ADVANTAGES
apps
GCM is now connected with GAE(Google App Engine)
Used for sending message from Cloud to Device
Supports Push Notifications
DISADVANTAGES
Reduce extra network uses
Consumes less battery
There are some key terms and concepts involved in the GCM service and it is very
important to have a good knowledge about them. The key terms and concepts of the GCM are
divided into two categories:
Components The physical items involved in GCM steps.
Credentials The IDs that are used in different stages of GCM to achieve the
authentication, and to be sure that the message is going to the correct application
and the correct Android device.
GCM Servers
GCM server.
The Google servers used in taking messages
from the 3rd-party application server and
sending them to the device.
Credentials:
Sender ID
Application ID
Registration ID
An API key that is saved on the 3rdparty application server that gives the
application server authorized access to
Google services. The API key is
included in the header of POST
requests that send messages.
GCM LIFECYCLE
o Enabling GCM
o Sending a message
o Receiving a message
Enabling GCM
This is the sequence of events that occurs when an Android application running on a
mobile device registers itself into the GCM server to receive messages:
1. The first time the Android application needs to use the messaging service, it sends
registration intent to a GCM server.
This registration Intent (com.google.android.c2dm.intent.REGISTER) includes the sender
ID, and the Android application ID.
2.
If
the
registration
is
successful,
the
GCM
server
broadcasts
Sending a message
For an application server to send a message to an Android application, the following
things must be in place:
The Android application has a registration ID that allows it to receive messages
for a particular device.
The 3rd-party application server has stored the registration ID.
An API key. It is a key for the application on the application server and it is
previously set up in the API key file that exists in the application server app that
will be explained later.
Here is the sequence of events that occurs when the application server sends a
message:
1. The application server sends a message to GCM servers.
2. GCM servers store the message in case the device is offline.
3. When the device is online, Google sends the message to the device.
Receiving a message
This is the sequence of events that occurs when an Android application installed on a
mobile device receives a message:
1. The system receives the incoming message and extracts any data from it, if any.
2. The system passes the key/value pairs to the targeted Android application in a
com.google.android.c2dm.intent.RECEIVE Intent as a set of extras.
3. The Android application processes the message
C2DM
Advantages
Disadvantages
develop a new application server where the GCM Demo server application provided by Google
can be used directly. The following steps explain how to use it:
1. From the SDK Manager, install Extras > Google Cloud Messaging for Android
Library.
2. This creates a gcm directory under YOUR_SDK_ROOT/extras/google/ containing
these subdirectories: gcm-client, gcm-server, samples/gcm-demo-client, samples/gcm-demoserver, and samples/gcm-demo-appengine.
3. You can create a web application from Eclipse and copy the gcm-demo-server app into
it as shown below
4. In a text editor or from inside Eclipse, edit the samples/gcm-demo-server/Web
Content/WEB-INF/classes/api.key and replace the existing text (if any) with the API key
obtained above.
LITREATURE REVIEW:
Cloud
Messaging
(Gcm):A
Light
Weight
Communication
The leverage our time synchronization mechanism (i.e. GCM message type T) to collect
our data on the GCM message arrival times. To calculate precise times, use network time
protocol (NTP). The GCM message arrival time is defined as the difference between the time the
GCM message is initiated from our servers, and the time the client device receives that message.
Therefore, in our type T GCM message flow, the difference between the server NTP time of the
message initiation, and the client NTP time of the message arrival gives us precise GCM
message arrival time for each device. The client devices bounce-back to our type T message with
message arrival NTP timestamp, and we calculate per device GCM message arrival times in our
server. We evaluate these arrival times to elaborate how GCM performs. In addition to this time
data, we also record the network connection type (WiFi or cellular data) of the client devices as
well as the cellular service provider in order to test the effects of the connection type and the data
service provider.
ANDROID DEVICE:
The Android application is the main interface via which the user is going to use to receive
the push notifications. The important requirements for developing the application are listed
below:
o Client Application [14]: This application is developed using android
development studio inconjunction with SDK tools.
o SDK tools [14]: The Android SDK tools compile the code along with any data
and resourcefiles. The Android SDK provides the tools and APIs necessary to
begin developingapplications on the Android platform using the Java
programming language.
o .apk [14]: All the code in a single .apk file is considered to be one application and
is the filethat Android-powered devices use to install the application.
o Android OS [14]: Android is a Linux-based operating system designed primarily
for touchscreen mobile devices such as smart phones and tablet computers. It
enables replace andreuse of components.
CONCLUSION
Google Cloud Messaging for Android (GCM) is a free and powerful service that helps
developers to send data from servers to their Android applications running on Android-powered
devices. The basic concepts of this service with a detailed explanation of the GCM demo
application provided by the Android SDK. The GCM service is very promising and it could be
considered the most optimized and powerful method for sending messages from servers to the
Android devices without the need to have the Android application listens to the server in an
endless loop.
BIBLIOGRAPHY
[1] http://developer.android.com/google/gcm/gs.html
[2] http://developer.android.com/google/gcm/gcm.html
[3] http://developer.android.com/google/gcm/demo.html
[4] Google Cloud Messaging for Android Android Developers. [Online].
Available: http://developer.android.com/google/gcm/index.html
[5] Google Cloud Platform, Cloud Messaging Support.
Available: https://cloud.google.com/tools/android-studio/messaging/