Xamarin Forms [Android] Silent Push while App in Background => Freeze - android

I have a App that i now wanted to expand with Silent Push Functionality for a customers Feature Request.
But now i encounter a rather strange behaviour(app freeze)
The Used Xamarin.Forms Version is 4.8.0.1451 (Updates did not solve the problem)
The Problem is Android Only related
Normal Notifications work as expected and dont produce any error
Here the quick Behaviour:
Receiving Silent Pushes works if the app is in Foreground (Multible times no limit)
Bringing the App to the Background and back to Foreground works also flawles
Do i Receive a Silent Push while the App is in Background or the Device is Locked and i bring back the App to Foreground/Unlock the device the app seems frozen (unresponsive and App.OnResume does not get executed)
(Also to note: i can only receive 1 silent push when the app is in Background/Device is locked)
For now i dont do anything on receiving the Silen push (to isolate this error)
Debug output aswell as LogCat does not provide any info what so ever.
i could not track any managed code that does execute and not return properly from some method calls
i can reproduce this problem on android 11(Pixel3) and android 9(Blackview A60)
I hope someone here has an idea what this problem could be.
It more informations or details are needed, i happily provide

In Android, starting in Android 8.0 (API level 26), an Android application no longer have the ability to run freely in the background.
When in the foreground, an app can start and run services without
restriction. When an application moves into the background, Android
will grant the app a certain amount of time to start and use services.
Once that time has elapsed, the app can no longer start any services
and any services that were started will be terminated. At this point
it is not possible for the app to perform any work.
For more details about this, you can refer to Background Execution Limits in Android 8.0.

Related

Flutter Local Notification not sending a scheduled notification at certain circumstances

I opened this question to ask you a strange thing that i'm facing currently.
I have various assumptions on what the problem could be, and i want to share them with you to get a confirmation.
I premise that my intent is not to use FCM. The application right now was a test to send a scheduled notification with the module "flutter_local_notifications". When the scheduled notification reaches the scheduled time, it fires if:
The application is open
The application is not open, but the smartphone is on
The application is on debug mode, is not open and the smartphone is off
I set on my smartphone some permissions for the application to ignore battery-saving mode, to enable autostart, lock the application to avoid the Android's memory management.
But still, when i turn off the screen of my smartphone the app's notification won't fire at the scheduled time.
I tried to do some tests on other smartphone's and the outcome is pretty different. For the other smartphones it works pretty well.
I am currently using a "Realme 8 5G", i was asking, is it possible to find a solution to overcome this problem or the problem is just out of my hands?
Thank you for reading and your time.

Reopen my Flutter app in background on FCM message

all day I already despair of a waking up system for my VoIP app. I must have already read over 100 articles and documentation about it, however I have not found a solution that works for me.
Use case:
My app is running in the background. That means the home button was pressed
after my app was started and the device is in the home screen. As soon as a notification arrives, the app is supposed to open again on a certain route because a call is coming in.
In the lock screen I managed this pretty easily with flutter_local_notifications and within the app it was of course no problem either.
Note:
Only Android is important, the rest can be neglected
Android version 10+
Flutter version 2+
I appreciate any input on how to solve my problem and have a good week.
Kind regards,
Shiro

I don't want my Android app to auto-update onto users devices

We're currently running tests (that end in 2 weeks) with clients using an "older" version of our app.
The older app has a long-running scanner foreground service that will not restart on the MY_PACKAGE_UPDATE broadcast (wasn't implemented at the time). The new version of the app correctly handles this broadcast and restarts the scanning on MY_PACKAGE_UPDATE.
We need to roll out updates mid-test to fix a bug appearing on only some devices, and we are able to reach out to those specific users. The problem is that for any current users with auto-update turned on, their foreground scanning service will exit and not restart.
Am I correct that the MY_PACKAGE_UPDATE broadcast won't kick in yet? As in, it'll only begin working two updates from now?
Is there a way for me to turn off auto-updating for my app in the play store for all users?

Not getting push notification when swipe from recent

I'm not getting notification when user swipe the app from recent. I've notice that behavior occurs in some specific device for instance I've tested it on nexus devices and HTC devices it's working fine but when user swipe the app from the recent in huawei and some samsung devices it doesn't show notification. I mean i don't get onMessageReceived() callback
After some research I found out that in these devices when user swipe it from recent it force stop the app (the process is completely killed) and I don't get any notification. In huawei they have protected and unprotected apps and if I add the app in protected list from the setting, I start getting notification because i this case it doesn't force stop the app. and I believe in samsung they have the same thing with blacklist and whitelist apps.
I've also tried some solutions like restart the service onTaskRemoved() callbacks or make your app START_STICKY. I've also tried WakefulBroadcastReceiver but nothing is working for me.
So my question is how can i get notification even if it gets forced stop, like it's happening when swiping app from recent.
An old question, but I think it’s important to know that HUAWEI has a feature called “power-intensive app monitor “. It kills every app that runs in the background for a long time unless user gives special permissions to it.
The path to do this:
Settings -> Security & privacy -> Location services -> recent location requests: YOUR APP NAME -> Battery -> uncheck Power-intensive prompt, App launch: Manage manually: check all three positions: Auto-launch, secondary launch, run in background.
I don’t know if there's a way to do this programmatically. I think the best way is to create a sort of help activity and explain the user what to do if application won’t work.

Huawei power saver app allowing app to run in background

I've developed an app which receives push notifications from Parse. The app is designed to run in background so that notifications can be received even when app is closed.
But we are facing challenge with Huawei's devices due to its custom "power savings" feature which detects the app as power intensive and hence clears it from memory when screen is locked.
Are there any known methods to prevent the app from being restricted or to add it to "Protected Apps" list upon installation?
Note: We begun with GCM notificatoins, but after learning that GCM's notification deliverability is flaky, we moved on to Parse.com's PPNS and then this new roadblock.
We cant do much except detect the device,if device is huawei warn the user about propably issue if the desired app wont be added to protected apps hence this is the only way to do what we need.No other ways available and i reckon it will never be!

Categories

Resources