Search code examples
androidandroid-activitydefault

Change default activity after activation


I currently have three activities for my Android app, two of these are for logging in. The first is used for authorizing a device and requires the user to input more user information (FullLogin), the second is used once a device has been authorized (ReducedLogin).

The idea is to show the FullLogin activity all new users until their device has been authorized. The ReducedLogin activity will then show for all logins thereafter.

Is this possible and how would I go about doing this? I've seen some posts online for using/accessing values from a preferences.xml file but am not 100% sure if this is correct for my needs.


Solution

  • This scenario is formulated quite generally. There exist many possible solutions.

    1. You could save the information whether a user is fully authorized on an external server and each time you start the app, you request the server and then show the corresponding activity.

    2. You could store this information locally on the smartphone (e.g. in SharedPreferences), but for security reasons i would rather recommend the first way. One big advantage of local storage may be the avoidance of the additional internet permission as you don't have to request a server.

    3. You could use cryptography to create a challenge that can only be solved by an authorized user.

    4. You could combine these approaches.