-5

I have some problems with multi-screen launching app.

My app is a custom launcher that opens certain apps (lets say A, B, C). Every second time after uninstalling and installing my launcher, it works incorrect (first time it opens apps properly - one under another, and second time it opens apps on the same multi-window).

It repeats every time and has no exceptions. I'm using shared preferences for detecting current opened app (some apps must have Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT flags and some must not), but i'm checking with Logs that state and its same every time (correct), so i can't understand how can that happen with the same app, without any code change every second time. And by the way I tested it on different emulators and devices, every time it repeats.

Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="aviation.com.aviation">

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>

    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
    <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
        tools:ignore="ProtectedPermissions" />
    <uses-permission android:name="android.permission.GET_TASKS"/>


    <application
        android:name="aviation.com.aviation.app.AppContext"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:stateNotNeeded="true"
        android:resizeableActivity="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">


        <activity
            android:launchMode="singleTask"
            android:name=".activity.MainActivity"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <service android:name=".kiosk.KioskService" android:exported="false"/>



        <service android:name=".CustomAccessibilityService"
            android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
            <intent-filter>
                <action android:name="android.accessibilityservice.AccessibilityService" />
            </intent-filter>
        </service>



    </application>

</manifest>

1 Answers1

0

See if your <activity> in AndroidManifest has android:noHistory="true" attribute.

GreenROBO
  • 4,725
  • 4
  • 23
  • 43