2

I am developing simple home screen application. So when i press home button i can choose between native and mine home screen app. The problem is: if i set my app as default home screen application when i restart phone i can't enter native home screen app because it has never started so my app stands on top off stack. How can i enter native home screen app when i restart phone if mine is default home screen app? I have idea: On boot, i can check the calling intent - if it contains the Home category, i will call native home screen app. Something like this:

 Intent creatingIntent = getIntent();
 if (creatingIntent.hasCategory(Intent.CATEGORY_HOME))
 {
     creatingIntent.setPackage("com.android.launcher");
     creatingIntent.setComponent(new ComponentName
     ("com.android.launcher",
     "com.android.launcher2.Launcher"));
     startActivity(creatingIntent);
     finish();
 }

But the problem is i don't know how can i get Component name for native home screen application, can someone help?

prowebphoneapp
  • 77
  • 1
  • 11

1 Answers1

1

The goal of an home app (=launcher) is to replace the native launcher, it's weird to force the cohabitation of 2 launchers. But if you success to do something like that, when you press on the home button it will launch also the Native launcher.

To answer your question, the native launcher depends of the target device. Example : samsung doesn't use the same launcher than google, so components name will be different.

Have you tried to do a broadcast receiver which launch your app at start up ? With that, you don't have to put your apps as default home app, so you conserve the choice when you press on the Home button. However, it's not a solution if a user choose your app as default app.

Maybe you can look here How to use customized screen instead of default start screen in Android?

Community
  • 1
  • 1
Goo
  • 1,308
  • 1
  • 13
  • 29
  • 1. I know that the native launcher depends on device type but i guess that there is a way to get its component name programmatically. 2. If user don't set my app as default then whenever he press it again same dialogue will pop us, so it is unpractical. – prowebphoneapp Jan 31 '13 at 12:44
  • @prowebphoneapp: "i guess that there is a way to get its component name programmatically" -- not reliably. – CommonsWare Jan 31 '13 at 14:21
  • Yeah it's clarely unpractial.As says CommonsWare, it's not sure. You could look for near the packageManager (which manages component), [here](http://stackoverflow.com/a/5097838/1720391) – Goo Jan 31 '13 at 14:30