Am working on an application in android that does the following. A part of the application is that the administrator can send universal notification to everyone registered to that application. I want this service to be in a way that the administrator uses his wireless to send the message to cellular gsm service. Now i was thinking it that is possible in android. How can i possibly do that?
A part of the application is that the administrator can send universal notification to everyone registered to that application. How can i possibly do that?
You can use Google Cloud Messaging for Android. It a service that allows you to send data from your server to your users' Android-powered device, and also to receive messages from devices on the same connection. You can send messages( or notifications) to all the Android users of your app. Each user would have a registrationId which would be unique for each user ( if you register them). That ID can be used to send messages to all your app users.
P.s: By wireless I am assuming internet.
Related
I am developing an android app, through which the user can lock the phone, or factory reset the phone using SMS from another phone(accompanied by a password ofcourse) incase the phone gets stolen. I was wondering whether it is possible to send SMS to the stolen phone using its IMEI number(Incase the theif replaced the SIM card)? I want to include this facility in my app. Is there anyway Google Cloud messaging could be used for this purpose, to send a message to my application on a particular android phone.....? Any help is very much appreciated.
Of course you can use GCM for this purpose.
If you setup your app to use push notifications, while it is installed on the phone, you may contact it by push notifications (e.g. GCM), if there is an internet connection available. There is no need to know IMEI of the device, till GCM will use a registration token which will be your target, to send push notifications to.
I want to know if it is possible in google cloud messaging api to send messages directly from one android device to another without relying on our app server. I don't have a server so is it possible to send messages device to device through gcm?
GCM supports device to device messaging. However, your devices would need to somehow know registration ids of each other, which is hardly achievable without coordination from your own server.
Currently sending a device to device message is not possible with GCM, even if the two devices have exchanged InstanceId tokens.
I wanted to know how to address a specific android phone to send push notifications as the google's gcm is slow and also as i want to learn how to send push notifications without google cloud messaging and to build my own api for sending push notifications to other platform devices .
I'm not sure how to address an android phone whether by its IP address or keep a socket for listening at a port.
Please help!
You not need to use ports or some listening mechanism to build. Use the Google's GCM way.
You need to build a service that will periodically check your server for any massages to get (fetch) for your specific device (keep a self created unique id with each device and registered the device on your the server by that id). Actually this is not pushing. but this is what happening in the GCM server also. When you put some massage for some specific device to your server(it is the pushing) the device will grab that by the service running on it.
simply you have to create a server by yourself (like GCM server)
Then you have to create a service to run on mobile to check updates on your server (like android play service)
Hi i want to use push notification on android device and get device location for more information
I want to write application for android that when server want to get android device location push a notification timely to the device and the application on the device send device location to server timely.
I can't use Cloud to device messaging service because this service need that user first online and after user is online send server notification with C2DM service!.But i want to send notification to device and get device location any time server wants.
For any sort of push notification to be made possible, your client will need to be online. An offline client cant accept push notifications until it is online.
A C2DM push can be initiated by the server. No need for client to start it. The server just needs to send a message to the C2DM server and notification will be sent.
What you basically need to do is, on receiving the notification from C2DM server, make your C2DM base receiver call a function, which retrieves the clients location data using LocationManager and send it to the server.
EDIT for MQTT:
i havent done this much myself but it can be used for push service
You need:
an MQTT broker which runs on the server side, like the mosquitto broker which is Open Source.
an MQTT client library which you include in your Android app, enabling your app to connect, subscribe, and publish messages. refer this http://mqtt.org/software
to come up with a way of uniquely identifying users or devices, and then use that as a topic so that you can individually publish a message to one device.
Is it true that if a user does not have Cloud to Device Messaging (C2DM) in his account the C2DM will not work?
If so, how can I do push notifications without a Google account?
The different techniques to send push notifications can be listed as follows
Android Cloud to Device Messaging (C2DM) on OS2.2+
Other techniques for pre OS2.2 Devices.
Cloud to Device Messaging (C2DM) OS2.2+: The standard push notification method used in the android platform is called Android Cloud to Device Messaging (C2DM). The service provides a simple, lightweight mechanism that a server can use to tell an app to contact the server directly, to fetch updated data.
C2DM allows to send lightweight messages to android apps. The messaging service is not designed for sending a lot of user content via the messages. Rather, it should be used to tell the apps that there is new alert on the server, so that the application can fetch it.
C2DM limitations:
The message size limit is 1024 bytes.
Google limits the number of messages a sender sends in aggregate, and the number of messages a sender sends to a specific device
C2DM makes no guarantees about delivery or the order of messages
C2DM requires users to set up their Google account on their mobile devices.
C2DM requires devices running Android 2.2 or higher that also have the Market application installed
Server should be
Able to use HTTPS to communicate with C2DM Server.
Able to communicate with our client.
Able to fire off HTTP requests to the C2DM server.
Able to handle requests and queue data as needed. For example, it should be able to perform exponential back off.
Able to store the ClientLogin Auth token and client registration IDs. The ClientLogin Auth token is included in the header of POST requests that send messages. For more discussion of this topic, see ClientLogin for Installed Applications. The server should store the token and have a policy to refresh it periodically.
Other techniques for pre OS2.2 Devices:
Poll rather than push
SMS
Persistent TCP/IP
Third-party offerings
Poll rather than push: Android app can periodically poll the server for new messages from a background local service. The more often you poll the closer you get to the real-time push.
Adv: Easy to implement.
Disadv: Not real-time.Will kill the battery.
SMS: Android apps can intercept text messages in the android phone.So if a server can send an sms when there is a notification, the android app can receive the sms and then check for new data at server.
Adv: easy to implement. Fully real-time updates.
Disadv: Can be costly to do.
Ericsson labs provide a hosted service which allows upto 2000Sms's to be sent.
Persistent TCP/IP: The android app initiates a long-lived mostly idle TCP/IP connection with the server and maintains it by occasionally sending keepalive messages. Whenever there is something new on the server, it sends a messages to the phone over the TCP connection.
Adv: Fully real-time updates.
Disadv: Hard to implement a reliable service on both the phone and the server side. The Android OS is known to be able to kill services when it’s running low on memory, so our notifications service can easily disappear. What happens when our phone goes to sleep? Imagine if all the apps use the same technique . there will be plenty of open connetions which will drain the battery.
Third-party offerings
Urban Airship Push : The big disadvantage is that it requires the user install the AirMail app onto their device.
The deacon project
xtify
pushdroid.org