Xamarin crossplatform, how to reliably send events from server to client - android

I'm creating video chat (like skype, but for a specific type of companies) apps for Android and iOS using Xamarin. I'm wondering what the best approach is to handle the server to client communication, specifically when a call is coming, how do I fast and reliably contact the receiver ie client phone?
I want to be able to contact my App even if it is closed
I need to know if the message have gone through
It has to be fast, preferably under 1 second
I've read about push notification and they can wake my app, but they are slow and no guarantee they will get through.
I've been looking into SignalR which are fast and reliable, but I can't quite see how to open my app.
Currently I'm thinking about setting a status wether or not the app is open. If it's open I'll use signalR else the caller will be asked if he wants to notify the receiver about the incoming call. Does anyone have better idea?

Related

How to receive calls/messages real-time when the application is closed

I am developing a VoIP application with SIP as the signaling protocol. I have implemented the messaging and calling functions and they work when the app is in the foreground. To make the app listen to the call and message receiving when it is closed, I created a foreground notification so that the app would always be in the foreground.
The problem is that the above method consumes a lot of power which is unacceptable. I have also noted that famous VoIP applications like WhatsApp and Signal are not using foreground notifications but, they manage to inform us about incoming calls/messages no matter the app is closed. I wonder how to achieve the same functionality. Could anybody please point me in the right direction?
This kind of App should use Push Notifications (reference: https://firebase.google.com/docs/cloud-messaging) that use ONE SINGLE socket connection for the whole system: each App should register itself for receiving Push, then when the Server triggers (many languages are supported by FCM with examples/tutorials) the Calling Event then a special "message" is sent to the App (providing some information about IP or whatever you want) that gets those information and acts in the proper way.
Unfortunately FCM, after few thousand notification per month, requires payment.
There are other similar online service, but those services requires a fee because they should handle many users connected at the same time and it requires hardwar and bandwidth.

Sending Notifications to android app? How to implement server-side (own server, FCM)?

I come from the JavaEE development and I'm totally new to android app developement and I'm a bit confused how to implement my requirements. I have a server, where the user has to authetificate and can perform CRUD-Operations via REST-webservice. When a specific event is triggered server-side I want to send a notification to the app. The user should recive the notification even when the app is not running at the moment.
So now my questions:
What do I need on client side so I can recieve this notifications even when the app is not running? Or do I recieve them even if the app is not running? The data input from the notification needs to be safed app-side.
How do I send a notification from my server if the event is triggered? Do I have to use FCM(/GCM?) or can I directly send notifications from my server to the app?
Any help is appreciated!
Typically, 'instant notifications' are done via websocket severs, for mitigating the process of setting one up yourself, people typically use something like Pusher, which has a library available for java, or you can obviously use FCM/GCM. In conjunction with this document you should be able to keep the service running on the andriod app even when running in the backround so you can still send notifications, just remember you'll have to still attempt to detect if they have internet connection or not when sending out those notifications.

Can my server send data to my iphone / android app proactively?

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.
I can speak to an iOS solution. Android surely has very similar functionality.
There are 2 ways to accomplish this:
Silent push notifications
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.
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
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

Android Mobile App Push Notification

I am attempting to make an Android app which will allow a user on a queue system to be notified if it's near his turn.
I would like to know if it's possible to make an Android App, that would upon connecting to the internet, connect to a server and then get assigned an ID, which would compare it to other IDs and check it's position on a queue. If it's"for examnple" less then 10 people in front of the user, to send a push notification, even if the app is closed, saying it's almost the users turn.
If it is possible, is there any tutorial available on the matter? I searched a while, and nothing of what i found appeared to be my solution.
Wrong choice of words perhaps.
EDIT: What i am asking for, isn't a tutorial to build the whole app itself, only a tutorial to make automatic push notifications upon connecting to the internet basically

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.

Categories

Resources