Xamarin.IOS And Signalr Push Notification - xamarin

I'm Developing A Xamarin App, I Create A Signalr Notification System That Work Fine In Both Xamarin.Android And Xamarin.IOS But It doesn't work when Xamarin.IOS App close.
Is There a way to fix this without using APN Or FCM?
Is There Way to IOS Let My app Do something even When App is Closed?

It is not possible to keep the signalr connection alive while in the background on iOS. The operating system will kill it, there is nothing you can do to stop that from happening. iOS immediately kills the app (you have 5 seconds) when going into the background, with a few exceptions.
If you are using android, you can create a foreground service to keep the signalr connection alive. Without a foreground service, android will also kill the signalr connection after a while. Android will allow a background app to run for a period of time, then will kill it, so you must have a foreground service to keep signalr connection alive.
Also be aware while in debug, iOS will allow apps to run in the background. But the released version will not allow apps to run in the background. This can make debugging signalr difficult, as it will work in debug, but not in the production version.
You will probably need to use APN for notifications. Be aware that APN requires a HTTP/2 back end server if you want to send the push notifications directly to Apples servers. Or you can use FCM to send APN.

Related

Stay connected to code-server even when Mac is asleep or I move away from the PWA on iPad

VS Code has this new feature they’re rolling out where you can spin up a code server on your local machine. Essentially you just enter code-server into the terminal on Mac and you can connect via vscode.dev and you can add this URL as a Progressive Web App (PWA) to your iPad Home Screen.
My issues are:
Every time my Mac sleeps it shuts down the server
Every time I switch apps on my iPad I’m forced to reconnect
Is there any way to keep this server running even while my Mac is sleeping? Any way to maintain the connection even when I’m not in the web app?
I know this is a new product so any help is appreciated.

Xamarin FCM not working while app is closed

I am using Firebase cloud messaging for remote notification in Xamarin Android, the notification are working fine while the app is in foreground and in background but if the app is closed the notification do not arrive.
I followed step by step the Xamarin tutorial.
Any idea?
The problem happeds because VS literally kills your app, so the background proccess that listens for push notifications die, so it will no longer respond. What you have to do for test push notifications is debug and reinstall de app every single time.
Best Regards.

Push FCM Xamarin like WhatsApp background

I have a problem on Devices Xiaomi and Lenovo Phones, when i close app from task manager they stop receive GCM messages, the gcm messages receive only at foreground and app on task manager list. How do i to keep app or service running on close at task manager? Obs: samsung phones keep as well on both cases.
As stated in this thread, Lenovo mobiles are using Background task killer to stop background apps. To hide task killer, untick restrict in application menu.
Also, as mentioned by #AL. in this post, it may very well be possible that when an app is stopped from multi-task tray in that device, it is actually killing the app, causing the services and other background processes associated with it to also be destroyed. Suggested action is to make use of the START_STICKY flag.
Another reference which might help.
In Xiaomi phones, they whitelist or blacklist an app based on certain criteria. If you download an app and if it is in their whitelist, they'll permit the app to show notifications. If not, you already know what happens. But the good thing is that you can change these settings. Look for an app named Security. If you revoke the right permissions, even WhatsApp will stop showing notifications.

TTimer not working while iOS app in background

I have an app that needs to perform some actions based on a TTimer.
When the app becomes inactive (in background), the timer stops working.
I could not find any relevant options for UIBackgroundModes.
How can I make a timer keeps running?
iOS pauses your app automatically shortly after it goes into the background. You need to let iOS know that you are going to continue operating in the background.
In Project > Options > Version Info you can add to the array key UIBackgroundModes the string values for the services that require to continue running in the background. This gets added to the info.plist for your project on iOS.
You can consult Apple's documentation on what these values do . . .
Value - Description
audio - The app plays audible content in the
background.
location - The app provides location-based information to
the user and requires the use of the standard location services (as
opposed to the significant change location service) to implement this
feature.
voip - The app provides Voice-over-IP services. Apps with this
key are automatically launched after system boot so that the app can
reestablish VoIP services. Apps with this key are also allowed to
play background audio.
fetch - The app requires new content from the
network on a regular basis. When it is convenient to do so, the
system launches or resumes the app in the background and gives it a
small amount of time to download any new content. This value is
supported in iOS 7.0 and later.
remote-notification - The app uses
remote notifications as a signal that there is new content available
for download. When a remote notification arrives, the system launches
or resumes the app in the background and gives it a small amount of
time to download the new content. This value is supported in iOS 7.0
and later.
newsstand-content - The app processes content that was
recently downloaded in the background using the Newsstand Kit
framework, so that the content is ready when the user wants it. This
value is supported in iOS 5.0 and later.
external-accessory - The app
communicates with an accessory that delivers data at regular
intervals. This value is supported in iOS 5.0 and later.
bluetooth-central - The app uses the CoreBluetooth framework to
communicate with a Bluetooth accessory while in the background. This
value is supported in iOS 5.0 and later.
bluetooth-peripheral - The app
uses the CoreBluetooth framework to communicate in peripheral mode
with a Bluetooth accessory. The system will alert the user to the
potential privacy implications of apps with this key set. See Best
Practices for Maintaining User Privacy for more information on
privacy. This value is supported in iOS 6.0 and later.
Notice you need to actually select the mode that matches what you are doing. You can't just select fetch when really all you are doing is background processing.

Windows Phone 7 push notification when the app is not running

I am trying to implement push notifications in windows phone 7.5
I bind the channelUri in App.xaml when the application starts up.
I can then switch my app to background and receive toast notifications based on the Uri.
But this requires me to first go the app and then make it to background.
Can I receive the toast without the app running? That is when the channelUri is not bound.
Is this a default behaviour in Windows phone 7 or whether I am missing a point here?
If this is the behaviour, how can I send some form of notification/ information to the phone when the app is not running?
I did see this Windows Phone 7.5 - Push Notifications when app is tombstoned.
Update:
I know the Channel is active up to 30 days, is it the same when I use only emulator?
App should be associated with a channel so as to receive notification and even when app is not running, if the notification channel is active, then the application will receive the toast
I think you are missing the point. In order to receive toast notifications you don't have to have the app running in the background. Toasts (and Tile notifications) are meant for when the app is not running at all. So, start the app to get a push-uri and then send that to the service. In theory you won't need one again after 30 days. When it comes to the emulator it will be available as long as the emulator is running. Once you shutdown/close the emulator, the push-uri is gone and you would need to re-request one. (Generally speaking, nothing is saved on the emulator and so closing and opening the emulator is like getting a new device everytime.)
Hopefully this helps

Resources