Xamarin forms SignalR Notifications background service when app is closed - xamarin.forms

I'm building a Xamarin Forms App that uses SignalR to notify a user when there's a new post. I am currently using the LocalNotication Plugin, It works great when the App is in the background using a simulator. However, when I kill the App(Swipe up) on the simulator, the SignalR disconnects, and I don't get Notifications anymore. How can I achieve something similar to WhatsApp and Instagram, basically being able to receive notifications even when the App is dead? I was thinking of Shiny 2.0 but not sure if I can receive notifications when App is not running.

Related

How to make video call with IceLink, when the peer app is closed

I have a Xamarin.Forms app. In it, I implemented video chat functionality (that supports iOS and Android) using IceLink. The video chat works when both the caller and the recipient have their apps open. Now I wonder how I can make a call to a device which has the app not open.
For Android
You can send notification by Firebase Cloud Messaging when device do not open, click the notification to open your application, show the video chat page.
If you use a high priority FCM for an app, it will allow that app to run services in the background for a short period of time. This would be a good alternative to having a background service that polls an app in the background:https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/services/#background-execution-limits-in-android-80
For iOS
You can refer to Jack's reply.
https://stackoverflow.com/a/60001529/10627299

Sending an individual push notification to a specific user of webview Android application

Is it possible to send an individual push notification to a specific user of webview Android application?
I have a webview based Android application. Android 8 blocks all background processes and my application can not anymore check for messages every 5 minutes and to show push notifications is there are new messages. As I understand almost the only solution is to use firebase to show notifications.
My question is: can I send individual Firebase notifications to webview application users? If yes, how? People who login to my website from Android phones, enter their data in a login form that loads my website. It's not a Android login form. How can I at the same time login to Firebase and how Firebase will know that this user is already logged in if it's only a webwiew application?
A webview is not capable of directly receiving Cloud Message payloads. The only browsers that works with Cloud Messaging are those that support the Push API.
What you can do instead is receive the payload in the native layer of your Android app (using a normal Android integration with a service that receives the payload), then proxy it to your webview as needed, using webview's ability to inject javascript into it (while it's visible). This definitely is not a trivial amount of work.

Is a Firebase Notification Received for a web app running on a mobile browser in the background?

The natural way to use Firebase on mobile is using Android or iOS.
However, I'm in this situation where a client who developed a web app wants to receive push notifications when:
The web app runs on a mobile browser
The mobile browser app is in background
Is that possible?
Note: According to Firebase Documentation, client web apps can receive push notifications when they are in background, but I'm not sure if that extends to web apps running on a mobile browser in background.
Yes, you can receive push notifications on your mobile even when your browser is not open, but you need to enable it by pressing Allow when prompted, as below.

Signal R Vs Push Notifications for real time applications like Chat

I want to create a chat application for ios, android and windows phones as well as it should work with browsers in the future. My search led me to using Signal R with Azure Mobile Services(AMS).
My questions:
1) SignalR uses Websockets under the hood. Is websocket supported in Android, IOS, windows phones and all mobile/desktop browsers??
2) If not, how will it effect using SignalR with AMS?
3) Or should I just use Push notifications supported in AMS?
4) Any sample app/code snippet you can share. Note that I will be using Xamarin for my app development.
5) Any advice you can give for same.
Azure Mobile Services has SignalR integrated, and Azure Mobile Services provide a SDK for client apps, I suppose it is provide out-of-the box
See
Real-time with ASP.NET SignalR and Azure Mobile .NET Backend
Master the Managed Azure Mobile Services Backend–Part Four
High value mobile backend capabilities included
You will find many capabilities included in Mobile Services and readily available for your Web API. Mobile push notifications, real-time notifications with SignalR (auto-scaled out), social auth for your consumer apps, offline data sync for occasionally connected scenarios, to name a few.
Samples:
https://github.com/gshackles/RealTimeGallery
Sample to help developers to implement Push Notification, through Azure Notification Hubs, in mobile applications.
Note:
Azure Mobile Service is based in WebAPI!
For that you want, you should not use only Push Notification because Push Notification in iOS could not be read by the application if the user ignore it, only in android or windows you can get and save it. Another thing that can be a problem is the fact if the app is running you should not show the push notification and you should show a pop up with the notification... and the push notification can have a delay from the Push Notification Service (Apple, GCM, WNS...). Push notification are a notification that something happened in the app when the user is not using it.
In my opinion you should use AMS+SignalR for realtime communication and then Push Notification for update the user then he not using the app.
Using SignalR is efficient to save yourself from hitting any push notification cap if you ant to limit your costs. But you'll need to either turn notifications on/off at the right time when the app becomes active or inactive, otherwise the app may go in the background and push notifications won't be sent.
You can use a pure push approach where notifications are shown when the app is inactive/in the background, and whenthe app is active, you simply intercept the notification in the app, consume it and cancel it so it doesn't get shown. I have written a blog post on this approach along with 3 samples in Github for iOS, Android and Windows Universal at http://www.ageofmobility.com/2014/10/06/azurechatr-building-a-cross-platform-chat-app-for-windows-ios-android/.

Can we receive Raw push notification if WP 8.1 app is closed?

I am creating a Windows Phone 8.1 App,in which I am capable of receiving a raw push notification using WNS.
I discovered following two scenarios:
1)Notification delivery event,used when app is running i.e. in foreground
2)Background task triggered by the raw notification,used when app is not running .
I am able to receive Push notification when application is in foreground and when not running(in background).To receive notification in background I used background task.
Means I can receive notification in these scenarios:
1)when app is in foreground
2)when app is in background
I am able to get notification when app is in background as I registered background task.
Will that background task work when app is not in memory?
I am not able to receive notification when application is closed.
My question is:Can I be able to get that raw push notification when my app is closed and I registered with background task?
Any help is appreciated.
Thanks.
Yes, you should be able to get the raw push notification when your Windows Phone XAML or Silverlight 8.1 app is closed and you've registered a PushNotificationTrigger. See http://code.msdn.microsoft.com/windowsapps/Raw-notifications-sample-3bc28c5d for a sample that does this (it's a universal app that works across windows\window phone 8.1).
One common issue for PushNotificationTrigger not firing is if you have not called BackgroundExecutionManager.RequestAccessAsync() and validated its return value before registering your background task. This is required for both Windows and Windows Phone when using PushNotificationTrigger (note: all triggers requires this call for Windows Phone unlike Windows).
I think, Windows Azure Mobile Services can do that. If you want to try this is the link. Windows Azure is trial for 90 days.
Windows Azure Free Trial 90 Days. Click to Register.
Here is the Mobile Services Tutorials.
Windows Azure Mobile Services .Net Backend. Tutorial
Windows Azure Mobile Services Javascript Backend. Tutorial

Resources