Hi, I got the SerialPortDemo running on Android 5.1.1 and so I was able to acquire privileged access to some parts of the hardware through friendlyarm-hardware library. But now I need to programmatically shutdown and/or reboot the device. This requires su (root) access. In some other threads was a hint that Kingroot could be used to acquire root access but this doesn't seem to work with NanoPi M2 and the current Android 5.1.1 build. I also tried several other on-click root tools but without success. I do not really understand why FriendlyARM does not provide an Android with root access (like some other development platforms). But if this is strict strategy, I could live with it, when I could at least get the option to shutdown / reboot the device through friendlyarm-hardware lib. Regards Helge
Programmatically shutdown of NanoPi M2
Are you using your own compiled Android system? You want to programmatically shutdown device from SerialPortDemo app or another app?
I want to shut down from a self developed app that is using the friendlyarm-hardware library for serial communication based on the SerialPortDemo.
Just if someone needs it as well: App must be signed using the firmware key (like with the SerialPortDemo). In Manifest you must request android.permission.SHUTDOWN. In your code, you add: Intent intent = new Intent("android.intent.action.ACTION_REQUEST_SHUTDOWN"); intent.putExtra("android.intent.extra.KEY_CONFIRM", false); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);