Issue
In my application when user open app by click "app icon" then screen open by this flow
SplashActivity -> WelcomeActivity -> SignInActivity
when user open app by click "some link" then screen flow is
Splashactivity -> VideoActivity
when I open app by click "some link" then screen flow is same as above
Splashactivity -> VideoActivity
but when i press back in splash activity in this condition app goes to "SignInActivity" instead of close the app
manifest for Splash, Welcome, video activity
//splash
<activity
android:name=".splash.SplashActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data
android:host="tinyurl.com"
android:scheme="https" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
//video
<activity
android:name=".videocall.ui.VideoActivity"
android:screenOrientation="portrait" />
//welcome
<activity
android:name=".videocall.ui.WelcomeActivity"
android:screenOrientation="portrait" />
//SignIn
<activity
android:name=".videocall.ui.SignInActivity"
android:screenOrientation="portrait" />
I open Welcome activity from splash screen by this
val intent = Intent(this@SplashActivity, WelcomeActivity::class.java)
intent.flags = intent.flags or Intent.FLAG_ACTIVITY_NO_HISTORY
startActivity(intent)
finish()
So If I first open app by icon and goes to sign in activity and then put app in background and open app by click some link then If i press back button while I'm in splash screen then app need to be close not open sign in activity
So please tell me what to do in this situation
Solution
This is your activity stack:
Spash -> Welcome -> Sign-in
After open by link
Sign-in -> Splash -> Video
Because your app in background and the last activity is Sign-in.
How about if we use finish()
in onBackPress
of SplashAcitivity
?
Answered By - dinhlam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.