LockScreen Shortcut launch issue

  Kiến thức lập trình

for an android application, we add a second launcher, the second launcher necessary because we want user can access from lockscreen to some section of our application as quick as possible.
the problem is when the user in lockscreen click/swipe the launcher, after unlock the activity dose not open or open and immediately close its happen in some devices. but in other devices work fine.

main launcher :

        <activity
            android:name=".ui.pages.main.MainActivity"
            android:exported="true"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.SmartThings">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

second launcher :

        <activity
            android:name=".ui.roksana_widget.ActivityVoiceCommand"
            android:configChanges="orientation|screenSize"
            android:exported="true"
            android:icon="@mipmap/ic_roksana"
            android:label="@string/Roksana"
            android:launchMode="singleTask"
            android:roundIcon="@mipmap/ic_roksana"
            android:theme="@style/Trans"
            android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

i try to change the “launchMode” property and adding the android:taskAffinity=”.ActivityVoiceCommand” to activity tag but these does not solve the problem.
also i try to add the main launcher instead of second launcher to shortcut, and this work fine in all devices.
also i try to change the second launcher activity and its not solve the problem.
i use the second launcher activity in main launcher and then add the main launcher to shortcut, and its work fine, so the problem is not of the activity.

LEAVE A COMMENT