IOS/Android Push Notifications - Basic question - android

I don't know if this question has already been answered. In my IOS/Android app, I wanted to monitor a URL for updates (for example, UPS Tracking). I would like to know if I'm using a API for tracking parcels, and even if the provider says that they don't support Push Notification, is there any other way for my app to enable Push Notifications? All I need is get notified by APN or Android Push notification when there is a change in the package status even if the provider doesn't support it.
Also, is this possible with Urban Airship?
Thanks.

Ideally, you will need to build your own backend server to sendout notifications using Googles C2DM service: http://code.google.com/android/c2dm/index.html
I'd assume you'd send the paracel ID to your server, capture it, then check for updates periodically. Then, once the status has changed, leverage C2DM and push out the notification to your client.
If you choose to have a service on the device check for this, I'd be cautious - you can easily chew up a lot of expensive data transfer, for not a lot of value.

If I understand your question correctly, I think the recommended solution is to use a service to periodically check the URL for updates and if the status has changed, push a notification to the user from your service.

Related

Parse push notifications can take a long time to get delivered

I am relatively new to Parse, and am finding that push notifications can take anywhere from being instantaneous, to taking a day or more to deliver. I can see the notifications registered in the admin panel immediately in every case, so issue is not on the send side.
I am developing on Android, but need the cross-platform capability of Parse so I can support iOS.
Well you should prefer to use Google Cloud Messaging GCM for push notifications rather than using 3rd Parties like Parse etc. GCM is super fast and i am using in all my apps which are live.
Here are Good Links to Startoff with GCM
http://developer.android.com/google/gcm/index.html
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
I am aware about the parse notification.I am also having same problem,but the problem is because of the Wifi.
It means when you send an parse notification from panel it would take some time to deliver because of wifi is enable on your mobile.
So go with your mobile 3G connection it works within less time.
Turns out, Parse has a GCM handler, and it also needs to be added to the manifest. Otherwise Parse uses its own service, which can be very slow. Enabling GCM, I now have the notifications arriving in under 20 seconds.

How to get GPS Position of mobile user triggered remotely from a Website

One user manages mobile users via a website interface. By clicking on a button on that website I have to display the current position of the chosen mobile user. So what I need to do is send something to the mobile app to trigger sending the GPS position to my server. My website then starts polling the database to check every 10sec whether the GPS coordinates have arrived.
Questions:
Is it possible to use Push Notifications for this purpose? I already implemented it, so everything would be there.
Can I do that silently, so that the mobile user doesn't get notified? I have found something called Silent Push Notifications - is that what I'm searching for?
I have to do it on Android and iOS.
On Android it is definitelly possible. There is no default behavior (such as alerts/badges/sounds) to notify the user of the app that they got a notification. When the app gets a push notification, a broadcast receiver is created and its onReceive method executed. You can have whatever logic you need in that method, though if you require a logic that requires a long time to execute (such as server calls), you should start an intent service from the receiver and do you logic in the service (get the location of the device and send it to your server).
On iOS I believe it is possible since iOS7. Until iOS7, the application logic for handling the push notification would only be triggered after the user clicks on the notification/alert to open the app. iOS7 enable the app to do background processing as a result of the arriving push notification. I believe you should use the {"aps":{"content-available"=1}} payload in this case (which is used for background content downloads), since you don't want any payload that would be displayed to the user.
For android you have some ways to implement the push service:
GCM - http://developer.android.com/google/gcm/index.html:
MQTT - http://mqtt.org/
implement your own persistent connection.
All of them have their advantages. If you need a ack that the mobile client got the msg you should use MQTT. It is also faster than GCM because of less overhead and you don't have the GCM server in between. On the other hand GCM is easy to implement and you don't have to worry about the persistent TCP connection from your server.
Also the silent way is possible because you just trigger a service each time. so if you don't want a notification, the user don't get it.
I am not sure about iOS. For iOS6 it was not possible to implement your own service, which is necessary to "wake up" your app. I am not sure about about iOS7. So for iOS6 you definitely need to use Apples push server.

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.

Send push notifications on android without using C2DM

Is it possible to send push notifications to an android application without using Google server: C2DM?
So, I would like to have my own server which sends notifications directly to the app, but I'm not sure how are the notifications perceived by the device, because the device needs to receive notifications even if the app is not running and the notifications should appear in the notification center.
I think that the guys from www.airpush.com have managed to this, but I'm not sure how.
Can anyone help me with this please?
UPDATE:
Also I would like to know how to display the notifications in the notification center if I don't use C2DM? And if it is possible to configure the notification center to receive notifications from my server even if the user deletes the application developed by us, application which registered that device to receive notifications.
I want to send 3-4 notifications a day, but these notifications need to appear in the notification center and they should go only through our server. How can I configure the notification center within the app to make requests on my server for push notifications.
Thank You!
There is a solution from UrbanAirship called Helium push. According documentation Helium:
Works on Android 1.6 and higher
Does not require a Google Account
No default pushes per day limit
No default pushes per minute limit
Works on Amazon devices (e.g., Kindle Fire)
End to end Urban Airship support (i.e., API to to device)
Best throughput
The problem is that you need development app key for using this one.
Take a look at MQTT:
MQTT stands for MQ Telemetry Transport. It is a publish/subscribe, extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks.
It can be used (and was used in some applications) to implement custom server push solutions. One of the most well known applications using MQTT is Facebook Messanger.
You can easily find more information on MQTT in the Internet, e.g. in this SO question or in this blog post.
According to the FAQ on airpush.com, they're not using real push notifications but rather polling the server a few times per day. One reason I think this is a viable solution for you as well is that Android's C2DM apparently makes use of the Google Play Store, so it won't work on devices distributed outside of the Google eco-system. With over 5 Million Kindle Fires having sold already, that is worth thinking about.
From Airpush FAQ:
When executed once from the main activity of an Androidâ„¢ application, the Airpush client utilizes Androidâ„¢ OS's AlarmManager framework to schedule ongoing server polling events a few times per day. If an ad is polled from the server it is cached until optimal display time, which is algorithmically determined by the server.
Without using C2DM there's not option for a "real push notification". Because (afaik, correct me if I'm wrong) an android device registers at google (they can still deinstall malware from your phone via remote) and with this ip they are able to do a push notification. All other solutions could tend to be a "register at a server, keep the connection alive and wait for requests" or something and tend to be more battery-inefficient.
Parse has an excellent push notification service for Android, very easy to setup. More info here: Parse Android Notification Doc
If you want the user to only receive 3-4 messages per day and your messages are not bound to specific arrival times, you don't need pushing mechanisms.
Just create a service in your app that checks your own web service 5-10 times a day. If there is new data, make your app display it in the notification center.
If you don't want to have a service running all the time (like many messaging apps do), you can set up alarms (using the Android AlarmManager framework) that wake your app up regularily to check for new messages to display.
And if it is possible to configure the notification center to receive
notifications from my server even if the user deletes the application
developed by us, application which registered that device to receive
notifications.
That sounds like you want to write a virus or root kit ;-) You could use e-mails for your messages instead.
UPDATE 2013-12-30:
As just noted in my comment, rebuilding what GCM does is not a nice approach. It's enough when Google Services already load the device with this functionality. If your goal is just that Google does not see what messages you send to your users, you might aswell encrypt them. For Google not being able to actually read your messages, the client app should generate a key and send it to your server. All messages you send via GCM can then be encrypted using that key.
If you just want to circumvent Google's restriction on the amount of messages sent to users, you could pack multiple messages into one GCM notification and show them one after the other. But then again, we are back at some kind of polling solution as described before, with the exception that the user does not need to have internet access when you want to show the messages as they are cached on the device.

Categories

Resources