-1

I want to display Launcher app chooser dialog whenever I want but It is not displaying , app is getting closed.

This is my code :

    getPackageManager().clearPackagePreferredActivities(getPackageName());
    Intent i = new Intent(Intent.ACTION_MAIN);
    i.addCategory(Intent.CATEGORY_HOME);
    i.addCategory(Intent.CATEGORY_DEFAULT);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    startActivity(i);

If I set phone launcher as default by pressing always then it will not display the dialog , I am really confused why it is happening.

Nitesh Singh
  • 328
  • 3
  • 13

2 Answers2

2

it will not display the intent chooser in 2 different cases:

  1. if there is only one launcher app present in the android device.

  2. the current launcher app is set as default.

I dont know if there are any other cases as well.

Amrut Bidri
  • 6,276
  • 6
  • 38
  • 80
  • what is your case? 1 or 2? – Amrut Bidri Feb 16 '15 at 10:18
  • second one in my case – Nitesh Singh Feb 16 '15 at 11:19
  • go to settings >> apps >> your app >> clear defaults; **AND** go to settings >> apps >> launcher app >> clear defaults – Amrut Bidri Feb 16 '15 at 11:22
  • If I set phone launcher as default by pressing always then it will not display the dialog , I am really confused why it is happening. – Nitesh Singh Feb 18 '15 at 10:00
  • When home keys is pressed, the dialog comes, it will show list of launcher app, and below it there are two buttons. one is Always and other is only once. when you select one app and click on always, then that selected app will become phone's default launcher. **OR** when you select one app and click on only once, then that app will not be set as phone's default launcher(in this case dialog comes everytime you press home key). – Amrut Bidri Feb 18 '15 at 13:31
0

There is a 3rd possibility: the android OS is modified and does not respect the standards. I have this problem on a Huawei T1-701u tablet.

This tab has an extra screen for app standard settings. So the app-settings will always state "no standard set" and yet you will never see a chooser as the standard is controlled by a propietary system.

FrankKrumnow
  • 501
  • 5
  • 13