1、作为launcher启动:
与普通app不同的是加了两个
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
<activity android:name=".Main2Activity" />
<activity android:name=".Main3Activity"></activity>
</application>
2、进入setting:
通过包名启动设置
com.android.settings/com.android.settings.Settings
示例:(代码示例仅供参考)
private void goSystemSetting(){
try {
Intent intent = new Intent();
ComponentName componentName = new ComponentName("com.android.settings", "com.android.settings.Settings");
intent.setComponent(componentName);
startActivity(intent);
} catch (Exception e) {
Log.e(this.getLocalClassName(), e.toString());
}
}