How to send notifications when my app is not running? - android

I am writing an Android app. I want to send notifications to a device which is not currently running my app. I want to notify what all the new features my app will provide, or when i text something to a person he should be notified about that. How this can be done??
Can we do it with parse.com? If not then what?
Thanx in advance

Yes. You can use Parse Push Notifications for sending messages to devices directly. Another option available would be Google Cloud Messaging. Read more here..
But for all cloud messaging services, you will have to provide a background service which can receive this message and handle it as per requirement. Means, a service will be running in background even when the app is not running in foreground.

Related

Message Broadcast simulation in Android

I am developing a POC Message client in Android. This app mimics a messaging application, there is no server interaction. The application starts a new chat with a random user. I want to use Broadcast receiver & message object ( as in a real application ). As there is no server interaction, I want to create a Broadcast sender part in this app, which should randomly generate some messages; My app receives these messages through Broadcast receiver, process the message & show on UI. So, while demoing, it looks like a real messaging app.
If any one knows a simulator engine app in Android which I can use instead of developing a broadcast sender inside my app, Please let me know.
Or, if any one can suggest some better idea for implementing a mimic messaging application, please advise. Thanks in advance.
You can create a service for your app which will always listen on ACTION/signal/message you want. It will activate your app if it gets specific message. And it will run always in the background so that user will never notice it. Hope this will give you a hint.

Notify android app regarding content changes in the server

Prior to posting this query here, I have gone through a similar requirement by a user in the post here
Based on research, what I understand is, push notification concept can be used to notify the application of any changes happening in the server, if and only if, the server control rests with us.
I have made an application which would display the data from a mobile website. Is there a way out by which I can notify the handset user of any change happening in the server, such that the user gets an alert in his handset, so that he can open the application and see what is the new addition/change that has occurred in the website, when I have no control over the server? Pardon me , if I sound totally dumb with this question. Had such a requirement and was curious to know the way out, if any.
This way you should build your own web service which will poll other service for changing and then push alert to android device via Google Cloud Messaging for Android (GCM).
But you also can poll this service with your own application in background service. This method is very bad because of battery drain and network connection using, but this is no need for 3rd party services
try noczone.com, they have custom notification service with an easy to use PHP sdk
https://noczone.com/?page=custom_alerts_sdk
i use it to let me know whenever i receive a support ticket or any new registrations.
and you will need to have their app installed to receive notifications on it
https://play.google.com/store/apps/details?id=com.wr.noc

Android :Get Online or Offline status through SERVER

I am creating a app in android 4.0.3 i.e ICS version, which connects to the server when client gets login into the app.I am trying to get status of an client when he gets online or offline through server & seen onto the app screen.I am unable to proceed. Can anyone say me:
Is it possible to get the status of an user through server?
1-- How to proceed for first step...?
2-- How should I get a response from the server that the client is connected & viewed to other client example - when we login into skype our status shows available with green radio button, In same way how can I get it.?
It ll be very help full, If anybody guide me.
Many Thanks..
I'm assuming you're trying to develop a chat app ?
If this is the case, try using an XMPP library. XMPP is widely used for chat apps, including Facebook chat (and Google talk I think) and there are plenty of open source libraries available.
Otherwise, if you only want real-time notifications as a part of a bigger picture, try using push notifications. Google supports Cloud to Device Messaging (C2DM) for android. It allows to have push notifications to a specific device without you having to deal with persistent connections, battery and CPU use .etc.
C2DM approach comes down to this. When a client connects to your server, get a list of his friends and their 'C2DM IDs' and fire a C2DM push to their devices. This push is delivered to your app, and you can respond to it by firing a notification, or update UI .etc. (Your app doesn't necessarily have to be running. Push notification is delivered via a specific broadcast, and your app can register a receiver for it to wake up.)
Keep in mind that there is a quota for C2DM messages per device, per app and also a limit for the payload per message. So you're not supposed to send massive files via this. Just a notification to your app, so it can call your server and get an updated list, instead of polling.
You can get more info on C2DM and code samples here. https://developers.google.com/android/c2dm/
Hope this helps.
You may have moved on, but I'm posting for anyone who would run into this one in the future.
Firebase is a good solution to use in this scenario, if the app is always running when you want communication to happen. (It will not wake up your app as C2DM/CDM does, unless you have a service running all the time and still wouldn't wake up if the device is asleep... AFAIK)
It may be useful for some scenarios, but may be not for a chat app as you want the device to wake up when a message arrives.
Note that they have limitations on the free subscription though.

how to implement publish subscribe push notification in android mobile device without polling

Is there any way to implement publish subscribe push notification in Android ?
At the same time, client(application running in mobile app) should not polling server for informtion,so whenever there is update, server should publish the common message and the intended senders should receive it. (application running in a mobile app should not poll it)
Please guide me to this. Thanks in advance.
Is there any way to implement publish subscribe push notification in Android ?
Use C2DM. Since C2DM does not guaranteed delivery, though, you still will want an occasional poll to make sure you did not miss any messages.
Anything else that does push and might have guaranteed delivery (e.g., an MQ server with something like RabbitMQ as a client) would require you to keep an Android service running all of the time. Users or the OS can get rid of your service when they desire.

Android: Infinitely running Service for receiving events?

I have a requirement that my app, can receive events (e.g. messages) from server any time (even if app is not running). So do I need to create an infinitely running service to listen for these events?
This to me seems similar to Email apps in Smartphones, like whenever you receive a new email(event in my case), its able to show notifications and also able to update my list adapter whenever I receive an event.
But I dun know how will I implement this?
You should take a look at C2DM (push-messages):
http://code.google.com/intl/sv-SE/android/c2dm/index.html#intro
it allows a server to send messages to devices at any time.
From the link:
Here are the primary characteristics of Android Cloud to Device
Messaging (C2DM):
It allows third-party application servers to send lightweight messages to their Android applications. The messaging service is not
designed for sending a lot of user content via the messages. Rather,
it should be used to tell the application that there is new data on
the server, so that the application can fetch it.
[...]
An application on an Android device doesn’t need to be running to
receive messages. The system will wake up the application via Intent
broadcast when the the message arrives, as long as the application is
set up with the proper broadcast receiver and permissions.
[...]
Events from server are called "push notifications" and are implemented via "Cloud 2 device messaging" (C2DM). On the mobile side these messages are submitted as broadcast events (see BroadcastReceiver). For a complete example see some tutorials: Google, Vogella or here on Stackoverflow
I think you have to start a Service as soon as the device booted. There is a good tutorial here how to achieve this.

Categories

Resources