您可以將您的應用程序實現爲啓動器/主屏幕應用程序。
這是我知道通過按下Android 5及更高版本中的主頁按鈕來阻止用戶關閉您的應用程序的唯一方法。
<activity
android:name="com.example.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
一些詳細信息:how-to-write-custom-launcher-app-in-android
否則,你將需要自定義ROM
http://android.stackexchange.com/questions/85013/how-to一個植根設備這可能會幫助你-enable-task-locking-in-android-5-0-production-devices – VVB
你可以通過以下鏈接查看進一步的指導http://www.sureshjoshi.com/mobile/android-kiosk-mode-without-root/。 在Android活動中阻止開啓/關閉電源禁用系統對話框。 – Ajay