Skip REORDER_TO_FRONT trick which doesn't seem to work on newer Androids
probably due to background restrictions on Android 10+
This commit is contained in:
parent
585bfff11d
commit
de7057ac3a
1 changed files with 5 additions and 1 deletions
|
@ -10,6 +10,7 @@ import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
|
@ -776,7 +777,10 @@ public class RouterActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
if (isPaused) {
|
if (isPaused) {
|
||||||
buffer.add(runnable);
|
buffer.add(runnable);
|
||||||
if (!getActivityContext().isChangingConfigurations()) {
|
// this trick doesn't seem to work on Android 10+ (API 29)
|
||||||
|
// which places restrictions on starting activities from the background
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q
|
||||||
|
&& !getActivityContext().isChangingConfigurations()) {
|
||||||
// try to bring the activity back to front if minimised
|
// try to bring the activity back to front if minimised
|
||||||
final Intent i = new Intent(getActivityContext(), RouterActivity.class);
|
final Intent i = new Intent(getActivityContext(), RouterActivity.class);
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
|
Loading…
Reference in a new issue