-1

I have set my application as default home, Everything is going good but if i set Launcher as default home by my application(by mistake), then my app never ask to set my app as default and directly opens the Launcher home. I want that until my app is set as default home it ask user to set as default. Please help

Thanks in advance.

unflagged.destination
  • 1,576
  • 3
  • 19
  • 38

2 Answers2

0

Create a Preferences with boolean condition ....

Stored value false as default ...

start the Launcher by checking this condition

if the user sets your app as default launcher make the boolen preference true ....

Venkatesh S
  • 5,466
  • 1
  • 25
  • 30
  • No, I am not getting problem in checking that my app is set as default or not. Problem comes when i select android Launcher as default home(by mistake) and after that again try to set our app as default, at this time it launches directly android default home which is set previously. So now i am not getting that pop Up of setting default home. – unflagged.destination Nov 07 '12 at 13:02
0

You can check current default launcher by this piece of code:

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    ResolveInfo resolveInfo = getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
    String currentHomePackage = resolveInfo.activityInfo.packageName;

as shown in this answer: How can I get the package name of the current launcher in android 2.3 and above?

So simply check if currentHomePackage equals your App's Package and act accordingly.

If the user sets another App as Default Launcher the Dialog to choose a Default Launcher would only appear again if he delets the Launchers Defaults or removes/installs an App which can act as default launcher.

Community
  • 1
  • 1
Thommy
  • 5,070
  • 2
  • 28
  • 51
  • Yes i have done with the same process, But can't get the pop up which sets default again. Can i clear that android default launcher so i can select my app as default. – unflagged.destination Nov 07 '12 at 13:16