5

I 'am making an enterprise app, the user should be able to use only those applications which i provide him. My idea is overriding the default start screen with my custom layout with the app icons, of only those apps which i provide to the user. I will disable home, menu back and search buttons in the starting screen. Even if the user presses home button he should be redirected to my custom screen which contains icons.

I have seen an application which has achieved this without rooting the device. Here is the link for that app.

I just want to know how should i send the starting screen into background and my custom layout into foreground.

Anirudh
  • 2,767
  • 5
  • 69
  • 119

3 Answers3

6

Your app seems like a custom launcher (but with restrictives permissions). So you can define your app as a launcher, to do that you can add this in the manifest :

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter android:priority="1">
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

Then you have to implements a method to get back to the real launcher.

Goo
  • 1,318
  • 1
  • 13
  • 31
  • Strange, it works fine for me. Take a look here http://www.youtube.com/watch?v=Rn0UoFcv79c may be you can find what your looking for – Goo Jan 29 '13 at 08:41
  • I got a popup saying Complete action using Launcher or MyApplication(MyApplication is my app). If i select MyApplication with use by default for this action checkbox then i achieved my result, how to achieve this without the popup selection ? – Anirudh Jan 29 '13 at 09:59
  • The only way to do that is change the default choice for the launcher in the database. I think it needs a system permission, but i'm not sure. – Goo Jan 29 '13 at 10:03
  • It would be very helpful if you provide a link or an example. I tried a lot but i couldn't find any – Anirudh Jan 29 '13 at 10:04
  • yeah yeah, i'm looking for an example :) – Goo Jan 29 '13 at 10:05
  • http://stackoverflow.com/q/3836215/1720391 "only apps signed with the same signing key as signed the firmware can hold the SET_PREFERRED_APPLICATIONS permission" So I suppose that you can't avoid the chooserActivity Widget in your case. Commons ware is right, it possible with a custom rom else the user keeps the choice. – Goo Jan 29 '13 at 10:21
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/23560/discussion-between-anirudhmaddy-and-goo) – Anirudh Jan 29 '13 at 10:40
5

I 'am making an enterprise app, the user should be able to use only those applications which i provide him.

That needs to be a custom ROM.

I just want to know how should i send the starting screen into background and my custom layout into foreground.

Make your app be the home screen. There is an SDK sample available that shows how to create a home screen.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
2

Q: How should I send the starting screen into background and my custom layout into foreground ?
A: Using BroadCastReceiver, you can achieve this through intent filter : android.intent.action.BOOT_COMPLETED

But, I am very curious to know, how did you override home key press functionality.

Manjunath
  • 2,063
  • 2
  • 29
  • 60
  • The initial default screen pops up first, then it is redirected to my app. – Anirudh Jan 23 '13 at 07:29
  • Try giving some delay while launching your app...But, this is the only solution you can find buddy... :) – Manjunath Jan 23 '13 at 07:40
  • 2
    I'm not sure that is the only solution... As example, the Google SetupWizard which pop during the first start,is declared as a launcher (so the home button redirect to it). You can see how declared your app as a launcher in my answer. – Goo Jan 28 '13 at 13:53