Search code examples
androidonpausemulti-window

Activity has being stopped


I have an activity which has fragment and android.intent.category.MULTIWINDOW_LAUNCHER | android.intent.category.LAUNCHER intent-filter.

If I open the app firstly, it follows the following sequence : onCreate - onResume and activity works nicely ✓

If I open the application via pendingIntent on notification, it follows the following sequence : onNewIntent - onResume and activity works nicely ✓

If I shrink activity to split screen, it follows the following sequence : onResume - onPause although the activity screen appears, activities view operations are not working. I want to work in this state too ✗

Please help me.

<activity
            android:name=".android.baby.TabActivity"
            android:configChanges="layoutDirection|locale|keyboard|keyboardHidden|orientation|screenSize"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustPan|adjustResize">
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
            </intent-filter>
        </activity>

Solution

  • I read this tutorial and it was solved : https://developer.android.com/guide/topics/ui/multi-window.html#lifecycle

    For example, a video-playing app in this state should continue showing its video. For this reason, we recommend that activities that play video not pause video playback in response to the ON_PAUSE lifecycle event. Instead, the activity should begin playback in response to ON_START, and pause playback in response to ON_STOP. If you handle the lifecycle events directly instead of using the Lifecycle package, pause video playback in your onStop() handler, and resume playback in onStart().

    I have cared to onStart and onStop methods not onResume- onPause