Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>What is being asked in the question body is different from the question title.</p> <p>Listening to <code>BOOT_COMPLETED</code> will do literally what is requested by title - give control to the application once when device is powered on or restarted.</p> <p>It is not enough to achieve the real goal - to prevent user from exiting the application and reaching "normal" home screen - once user presses "exit" or "home", he will essentially leave your app. While you can intercept "Exit" button and prevent it from quitting your app, "home" button is not possible to block programmatically.</p> <p>In order to make and app like parental control and prevent user from reaching unwanted apps you need to implement "custom home screen" or "custom launcher" (which is the same thing). </p> <p>It is rather large topic, but this seems to be a good starting point: <a href="https://stackoverflow.com/questions/7107010/android-creating-custom-launcher">Android - creating custom launcher</a>.</p> <p>And because author insists on "exact code", to make your app to start instead of a home screen (after boot or pressing "home" button), you need the following in the manifest:</p> <pre><code> &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.HOME"/&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; </code></pre> <p>After install, press "home" button - you will be given a choice of standard launcher or your app. Check "use as default" and select your app - from now on it will start instead of the normal home screen.</p> <p>Beware, though, that there are few known issues with custom launchers. One is - you have to block access to settings, otherwise user can switch back to default launcher. Also, after your app is updated (i.e. you post new version) user will be asked what home screen to use and can choose default launcher. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload