Search code examples
androidandroid-activityservicelauncher

Specifying which activity to launch dynamically


I am developing a chat application.

Once logged in, the user should be navigated into the main page next time when he start the app. Like WhatsApp, it does not have a splash screen. So, Where do I do the check if the user has logged in or not next time ? I don't want to launch the login screen again if the user is already logged in.

Can I launch a service or something on the first time in which I can check which activity is shown next?


Solution

  • May be you can create an empty activity which extends Activity (not AppCompatActivity) and do the logic there since we can't launch a service directly.

    You don't need to call setContentView there. So no layout file is required. Add this in your manifest android:theme="@android:style/Theme.NoDisplay"