Search code examples
androidandroid-activityservicelaunch

Android If registered launch service activity else launch registration activity


I was wondering how to make my app launch the service activity if the user is already registered?, it wont have login activity but registration activity. So the app will start with the registration activity, after registration it will go to the service activity. When user closes the app, how to make it launch again from the service activity and not from registration activity?

How to make it recognize if it is registered go to the service activity and if it is not launch the registration activity(login data will be stored in sharedpreferences I dont know any other way how to do it though in case it disconnects it will have to reconnect again)

I will appreciate any answer, Thanks.


Solution

  • Normally for actions such as this I have an api where users login and if registered information then true is sent back, auto login if shared prefences found. If not then ask them to register. Keeping it in shared preferences isn't bad though, it will save on shut downs and should be fine.