androidauthenticationandroid-intentandroid-2.2-froyo

Programmatically starting the 'Add Account' activity in Android 2.2


I've been experimenting with the Android SDK over the past few days, in readiness to write an App for the store, however I've run across a bit of a problem.

The App I'll be writing requires that the user has a Google account associated with the phone. Retrieving and making use of the Auth token etc was not a problem, however I would like to be able to show the activity that a user would normal reach by going through the menus Settings->Accounts->Add Account.

Now through experimentation I've been able to launch this activity from the shell using the following command.

am start -n com.google.android.gsf/.login.AccountIntroActivity

I'm having trouble performing the same action in JAVA using the Intent class.

Would anyone be able to tell me firstly whether or not this can be done via JAVA, and secondly how I could go about it please?

If I have to settle for the Sync Settings screen then I will (this can be achieved through the Settings.ACTION_SYNC_SETTINGS intent), however it'd be quite nice to be able to direct the user straight to the required screen.


Solution

  • Check out the ACTION_ADD_ACCOUNT

    startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));