Reputation: 87
I have 2 questions about launcher below:
I have 3-4 launchers on device, how can i know which launcher has been set default on my device (with code).(Done)
I have own custom launcher app, I want clear default launcher on my app and without use:
Intent uninstallIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, packageURI);
uninstallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(uninstallIntent);
as some app as: Kid's Shell or Kids Place. I have try follow Clearing and setting the default home application but nothing change.
Please show me how to solve 2 things. Thanks for any advise.
Upvotes: 0
Views: 764
Reputation: 442
getPackageManager().clearPackagePreferredActivities(defaultLauncherPackgeName);
Added:
If you want to set your launcher as default, try:
ComponentName cN = new ComponentName(mContext, FakeHome.class);
p.setComponentEnabledSetting(cN, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
Intent selector = new Intent(Intent.ACTION_MAIN);
selector.addCategory(Intent.CATEGORY_HOME);
mContext.startActivity(selector);
p.setComponentEnabledSetting(cN, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
And in AndroidManifest.xml:
<activity
android:name="com.test.FakeHome"
android:enabled="false" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Upvotes: 1