2

I am pretty new to the mobile development scene and there is a very basic question to which I cannot seem to find the answer. Here is the scenario.

I have a mobile application. That application is connected to a server that I own. To use the mobile application, users have to login using unique credentials. Now lets say there are certain events on my server, about which I want to notify a particular mobile application user. Can my server proactively send a signal / data to the particular mobile app instance [using sessions data perhaps] so that a notification can be displayed on their screen?

Polling by mobile application towards the server to look for such events is not allowed / feasible.

Aman Kejriwal
  • 521
  • 1
  • 7
  • 28
  • This is really too vague. What have you searched for and what have you tried? Each major device has push notifications, plus it also depends on what structure your server is built upon. ie nodejs has some nice promise in live data transfer, there's ajax, meteor. the list goes on – Madivad Nov 12 '15 at 12:39
  • Well I did look at push notifications but was not able to determine if such a notification can be sent to particular users of the app rather than to all of them. – Aman Kejriwal Nov 12 '15 at 13:13

3 Answers3

4

I can speak to an iOS solution. Android surely has very similar functionality.

There are 2 ways to accomplish this:

  1. Silent push notifications
  2. Background fetch

A silent push notification can be, well uh, pushed to devices without alerting the users. This means that upon reception of the notification, the app can start downloading what it needs from your server. You will need to set up proper backgrounding for this to work properly. Otherwise, the notifications will be queued up and will only take effect when the user opens your app the next time. Start here for push notifications. The payload you send is what controls the notification.

Background fetching is process where your iOS app gets woken up by the operating system (iOS) periodically to allow you to perform a task. This task can be fetch data from a server or anything else you want pretty much. This is probably the best of the 2 solutions given that push notifications are not guaranteed to be received and this puts the onus back onto each device to fetch their own data as opposed to you creating a whole back-end system to perform the push notifications. Start here for background fetches.

bsarrazin
  • 3,990
  • 2
  • 18
  • 31
  • APNS is a good way but my developer is telling me that getting the device token from Apple is a long process and will take a long time. Is this true? – Aman Kejriwal Nov 12 '15 at 13:23
  • You can get APNS up and running in a very short amount of time, take a look at this answer: http://stackoverflow.com/questions/8798725/get-device-token-for-push-notification – bsarrazin Nov 12 '15 at 13:25
  • We are using Parse, https://parse.com, you can get up and running with APNS in less than an hour. – bsarrazin Nov 12 '15 at 13:26
0

You mean something like push notifications? You can read this tutorial (or any other tutorial on google) about how to implement push notifications in your app:

http://www.vogella.com/tutorials/AndroidCloudToDeviceMessaging/article.html

spcial
  • 1,529
  • 18
  • 40
0

Lookup about push notifications on each of the platforms you're talking about.

Plus look into some live web apps, two that come to mind are meteor.com and nodejs

Madivad
  • 2,999
  • 7
  • 33
  • 60