Using SpeakerPhone during Extreme Battery Saver Mode on Android 10

Universal Camera 276 Reputation points
2021-09-14T16:45:14.247+00:00

I have Xamarin.Android code that turns on SpeakerPhone. The code works great in a PhoneCallListener during no Battery Saver mode. How do I add permission to use SpeakerPhone in Android 10 during Extreme Battery Saver mode turned on?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,315 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 70,966 Reputation points Microsoft Vendor
    2021-09-15T07:10:53.323+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Here are no permisssion that PhoneCallListener can be executed in the Extreme Battery Saver Mode. It is by Google's design.

    Extreme Battery Saver lets Battery Saver turn off more features, pause most apps, and slow processing for even more time between charges.

    But you can remind Users to add Essential apps in Extreme Battery Saver. Apps will still run while Extreme Battery Saver is on.

    Oo save the most battery, choose only critical apps.

    1.Open your phone's Settings app.
    2.Tap Battery and then Battery Saver and then Extreme Battery Saver and then Essential apps.
    3.Pick which apps to leave unpaused.

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Universal Camera 276 Reputation points
    2021-09-20T03:59:49.687+00:00

    It looks like Extreme Battery Saver in Android 11 behaves differently in Android 10. It stems from how the Native Phone App is activated. There seems to be more pronounced lag when the Native Phone App is loaded in Android 11. So on that observation I re-wrote the section above with a built-in lag.

             if (state == TelephonyManager.ExtraStateOffhook)
             {
                    Task.Delay(2500).Wait(); //catch up with Phone App launch
                    App.audioManager.SpeakerphoneOn = true;
             }
    

    this solves problem both on 10 & 11.

    0 comments No comments