android / testing-samples

A collection of samples demonstrating different frameworks and techniques for automated testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to keep activity in the background in Android 11?

braver-tool opened this issue · comments

Query:

I created a sample application for video calling, Since I face one issue on android 11, If the app is closed or moves to the background during the call, the call activity is destroyed, then the call is disconnected. But android 10 below keeps the call activity in the stack. So how to keep activity on background in android 11 and higher? please give me a suggestion/source for that. Thanks in advance.

Testing Device: Oneplus 7

Android Version: 11

Keeping Activities in the background is not a good idea in this use case. Move your work to a Bound Service. Disconnect from the service when your app is in the background, and reconnect when it's back in the foreground. Activities that are in a stop/pause state are likely to get destroyed at any time when the OS needs to free up some space for other operations. Hope this helps.

It's working, Thank you for your reply @OGx09 );-