CapAm
CapAm

Reputation: 327

Keep the same application always

I not sure if this can be done. I want to develop a website and keep it in the device always, without the possibility of exit. I mean disabling the hardware/software buttons and only being able to power off/on. When you reboot automatically will be launch the app. I think this can be done rooting the phone or something similar, but I don't know how can I start. Any idea?

Maybe this cannot be done with a HTML page, but embedding that website inside an application and keeping that application always active...

Some point where I can start?

Upvotes: 1

Views: 149

Answers (2)

Erythrozyt
Erythrozyt

Reputation: 804

Sounds like you want to implement something like a Kioskmode. The Kioskmode is only available on Samsung devices. On other devices you have to implement a Kiosk by yourself. But it is possible! There are some nice tutorials in the web. However you need to implement an application to get the user interactions.

First of all you need to activate the Kiosk after booting the device. You can use a Broadcast Reciever to get the Boot Event:

<receiver android:name=".BootReceiver">
  <intent-filter >
    <action android:name="android.intent.action.BOOT_COMPLETED"/>
  </intent-filter>
</receiver>

You have to declare the permission in your manifest file:

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

You can start your implementation in a class witch extends the BroadcastReciever. Start the activity from the actual android context.

public class BootReceiver extends BroadcastReceiver
 {

  @Override
  public void onReceive(Context context, Intent intent)
   {
    Intent kioskIntent = new Intent(context, KioskMode.class);
    kioskIntent .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(kioskIntent);
   }
 }

In the activity you can disable every button of the device, like back pressed, etc. You can find a good tutorial for developing a kiosk under the following link, it shows how to disable power button, home button, back pressed,etc.:

http://www.andreas-schrade.de/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/

To disable the statusbar you just need to hide it with a theme:

android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"

To display a HTML Page you can use a WebView. However in a webview is javascript and all errors disabled. So if you just want to show some information on the page your good with a WebView.

http://developer.android.com/reference/android/webkit/WebView.html

Upvotes: 3

J Whitfield
J Whitfield

Reputation: 755

It is possible to use android for this type of scenario but only in Android 6.+

See Single use devices here for some information

I hope this is the information you are looking for.

Upvotes: 1

Related Questions