Auto boot when wall charger is plugged

好久不见. 提交于 2019-11-27 20:36:45

At last I got the solution, you can achieve this by deleting system/bin/charge_only_mode file. Please do that at your own risk and before deleting have backup of that file. I got the desired result that was boot when its connected to wall charger and now its working fine. All the best!

Moto e4 and Pixel 2 XL:

Get your device into the bootloader (fastboot) and run the following command from a computer connected over USB with Android Tools:

fastboot oem off-mode-charge 0

I also tried replacing charge_only_mode with a sh script that rebooted the phone but only got a red circle with the M (on a Motorola Bionic). Changing the script to the below got it working...Now I get the red circle with the M for a few seconds, then a blank screen, the another red circle with the M, and it boots on up.

#!/system/bin/sh
su -c "/system/bin/reboot -n outofcharge"
Hadi

On my device Lenovo K7000-Plus, the file need to be modified is kpoc_charger located at /system/bin.

Ipod file not working on my phone which using Android 6.0 ROM, but kpoc_charger works pefectly.

Regards

Hadi

For Lenovo A2010 phone,following worked:

  1. Use file manager phone app from playstore like Total commander(on rooted phone) to goto folder /system/bin/
  2. Copy file kpoc_charger and paste it there as kpoc_charger.bak
  3. Now edit the original file kpoc_charger using total-commander, replace all lines with following code:

    #!/system/bin/sh
    /system/bin/reboot
    
  4. Save it, goto properties and change UID:0 root, GID:2000 shell and permission as 755 (same as properties of other files in /system/bin folder).
  5. Now shutdown phone and plug to charger.
  6. Bazinga!!!! battery icon shows for a sec but phone sucessfully boots into os.

When phone get charging from outlet, I want phone to power up automatically without hitting any power button. (Not Working with wall Socket, but working when connected to USB cable via Laptop).

You can only achieve this by modifying your phone's OS files. Basically there is boot script/binary at /system/bin/chargemon which you can replace with a script that does nothing. Do it at your own risk because this may result in the device being damaged permanently. Also, Manufacturer warranty will become void.

I found another way for this (thanks to DavidThompson256 http://forum.xda-developers.com/showthread.php?t=1187631)

First make sure your phone is rooted (which I found iRoot very good for this), then install RootExplorer.apk (or similar) on your phone.

Try to edit "/system/bin/playlpm" and replace its content with following commands: (do not forget to make a backup first).

#!/system/bin/sh
/system/bin/reboot

(I know the content is in binary, simply remove them and write those two lines and save the file)

NOTE: When you modify that file, no changes will be applied on its permissions but if you are making another file remember to set permissions exactly as it was.

Finally, please do it on your own risk. It worked for me. (Samsung Discovery S730M)

i think there should be power sensor if you can add that in this code i belive it will work

public class Main extends Activity {
        private SensorManager mSensorManager;
        private PowerManager mPowerManager;
        private WindowManager mWindowManager;
        private WakeLock mWakeLock;
        private Button button;
        private TextView textView;

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
try{
            // Get an instance of the SensorManager
            mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);

            // Get an instance of the PowerManager
            mPowerManager = (PowerManager) getSystemService(POWER_SERVICE);

            // Get an instance of the WindowManager
            mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
            mWindowManager.getDefaultDisplay();

            // Create a bright wake lock
            mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass()
                    .getName());

            setContentView(R.layout.main);
            textView = (TextView)findViewById(R.id.textView1);
            button = (Button)findViewById(R.id.button1);
            button.setOnClickListener(mButtonStopListener);


        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            Log.e("onCreate", e.getMessage());
        }
} // END onCreate

        View.OnClickListener mButtonStopListener = new OnClickListener() {
            public void onClick(View v) {
                try {
                    mWakeLock.release();
                    textView.setText("mWakeLock.release()");
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    Log.e("onPause",e.getMessage());
                }

            }
        };

        @Override
        protected void onResume() {
            super.onResume();
            /*
             * when the activity is resumed, we acquire a wake-lock so that the
             * screen stays on, since the user will likely not be fiddling with the
             * screen or buttons.
             */

            try {
                mWakeLock.acquire();
                textView.setText("mWakeLock.acquire()");
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                Log.e("onResume", e.getMessage());
            }

        }

        @Override
        protected void onPause() {
            super.onPause();

            // and release our wake-lock
            try {
                mWakeLock.release();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                Log.e("onPause",e.getMessage());
            }
        }
}

So I was trying to achieve this with a 3rd gen Moto G. It has a charge_only_mode file as per Rohit's answer, but simply moving/renaming it did not make the phone reboot on charge. Instead it just sat there with a Motorola logo. I got the same result when replacing charge_only_mode with either of the scripts referenced here.

I did get it to work, however. I copied /system/bin/reboot into /system/bin/charge_only_mode, and that did the trick.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!