Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to make my application work in safe mode?

Tags:

I have an android application which lists installed and system applications separately. When the user tries to reboot the device from my application it will open my application instead of default home launcher.

But when the device is rebooted to 'safe mode' all logic crashes .ie, the device rebooted to my application in safe mode but it does not list any installed applications and stops its working.

  1. Is it possible to make my application work in 'Safe mode' also?

  2. Is there any way to prevent the device from going to 'safe mode' while running my application like using a RECEIVE_BOOT_COMPLETED broadcastreceiver?

  3. What is device admin applications? Is it helpfull in this situation?

  4. Is it possible to detect safe mode programmatically?

Thanks in advance

like image 317
Devu Soman Avatar asked May 24 '13 06:05

Devu Soman


People also ask

Can you use applications in safe mode?

In safe mode, all user apps are supposed to be disabled (that's the whole point), so you probably won't be able to do anything with your app then unless you have root access and install it as a system app.

What is Application safe mode?

Safe mode is designed to help you find problems with your apps and widgets, but it disables parts of your phone. Pressing or holding certain buttons during start-up will bring up recovery mode. For help with any step on your device, visit the Devices page, select your device, and find the steps there.

Does safe mode disable apps?

Safe mode on an Android device is a feature that disables all third-party apps on your Android device so that you can identify and fix problems within your phone.

How do I enable safe mode for the user app?

use the search option to find the app you want to be able to use in safe mode or just find it in the scrolling menu click on the app, click on tools, then press move to /system/app after the process is complete the device will have to be restarted the user app is now able to be accessed in safe mode

How to install software in safe mode in Windows 10?

How to Fix: Install Software in Safe Mode (Windows 10) Once you are in Windows 10 safe mode you will need to modify the Windows Registry and then start the Windows Installer Service. In safe mode: click Start, then type in "cmd" (no quotes); wait for "CMD.EXE" or "Command Prompt" to appear in the list, then right click it ...

What happens when you start a program in safe mode?

What typically happens is that once the program begins without loading custom settings, modifications, add-ons, extensions, etc., you can enable things one-by-one and then keep starting the application like that so that you can find the culprit. Some smartphones can be started in Safe Mode, too.

Is it possible to run apps in safe mode without root?

Device admin apps as well dont run. To run your app in safe mode, you need to copy your app to /system/app, for which you need root access. So only on rooted device it is possible. Show activity on this post.


1 Answers

I know this question is old, but perhaps this will help someone. If your application is Device Owner or Profile Owner on the primary user, you can disable safe mode completely (it works without root):

DevicePolicyManager manager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName admin = new ComponentName(getApplicationContext(), DeviceAdminReceiver.class);
// To disable safe boot
manager.addUserRestriction(admin, UserManager.DISALLOW_SAFE_BOOT);
// To enable safe boot again
// manager.clearUserRestriction(admin, UserManager.DISALLOW_SAFE_BOOT);

EDIT: You can set Device Owner or Profile Owner simply via ADB: https://developer.android.com/studio/command-line/adb#dpm

adb shell dpm set-device-owner com.example.deviceownerapp/.DeviceAdminReceiver

Note that you must have no accounts added when activating device owner (you don't have to do system reset though, just remove all account from settings). After device owner is set, you can add any accounts again.

like image 132
Robyer Avatar answered Oct 02 '22 13:10

Robyer