Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Activity at first launch (initialization wizard)

I would like to define my own "SetupWizard" application. To do so, I am using this intent-filter and it works fine :

<intent-filter android:priority="5">
        <action android:name="android.intent.action.MAIN" />
        <action android:name="android.intent.action.DEVICE_INITIALIZATION_WIZARD" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

However I don't know how to tell that the Wizard is over. For now, it is just looping after my last finish() call.

How can I tell it ?

Tkx.

like image 415
g123k Avatar asked Aug 13 '13 10:08

g123k


1 Answers

For a custom ROM, I did something like this after setting up the user:

PackageManager pm = getPackageManager();
pm.setComponentEnabledSetting(new ComponentName("com.domain.yourapp", "com.domain.yourapp.SetupWizardActivity"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);

This is what the CM setup wizard do to disable itself once finished. You need the CHANGE_COMPONENT_ENABLED_STATE permission.

My wizard activity has the following in AndroidManifest.xml:

<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.DEVICE_INITIALIZATION_WIZARD" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
like image 127
Alex Avatar answered Sep 30 '22 12:09

Alex