First, your Manifest is ok,
but in your exitApp
you want to finish the activity, right?
in your code you finish it and then start it again..
Pressing the home button brings me back to this activity (as it should),
but when I tap the Exit button, I don't get returned to the stock Launcher,
which is what I want.
if a user had installed another home replacment app (e.g. Go Launcher Ex
)
and if the user had set Go Launcher
as default before defaulting to your app,
you want to return to Go Launcher Ex, right?
I assume yes.
This is partially possible,
what you can do is prompting the user which home launcher to use
after exiting your launcher:
import android.content.pm.PackageManager;
public void exitApp()
{
//call this method to exit _CLEARLY_,
//and prompt the user which launcher to use next
//clear the default for your app (to show the prompt when exiting)
final PackageManager pm = getPackageManager();
pm.clearPackagePreferredActivities(getApplicationContext().getPackageName());
//exit _CLEARLY_
//calling finish(); would be ok also,
//but there would stay a 'zombie' in the dalvik cache
//and 'zombies' only use up your memory, so kill your entire app:
android.os.Process.killProcess(android.os.Process.myPid());
}
So basically what I want is that when you get to the HomeScreen
activity the first time, a prompt comes up telling you to select your
default Home Screen (this doesn't happen unless I press the Home
Button, I want this to happen as soon as the activity is launched).
then call this function in onCreate()
,
it simulates a homebutton press by calling an intent with Intent.CATEGORY_HOME
:
public void showPrompt()
{
Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
startActivity(i);
}
Hope this is what you wanted