J joneden Active Member Licensed User Longtime User Feb 26, 2013 #1 Hi All, It's amazing isn't it how you can do the most fantastic stuff really easily yet when you go to do something that should be doable with a blindfold on it's really tricky. I'm trying to reboot a Nexus 7 in my code. I've ensured that it is rooted but still can't do it. I've tried the following two approaches and neither work Code: Copy ' Method 1 Dim objOperatingSystem As OperatingSystem : objOperatingSystem.Initialize("OS") objOperatingSystem.reboot("User requested reboot") ' Method 2 Dim objPhone As Phone objPhone.Shell("reboot",Null,Null,Null) The first method gives me an error about the user nor current process has reboot permissions (I added the reboot permission to the manifest). The second method gives me an error that says reboot operation not permitted Any suggestions would be very gratefully received! Regards, Jon
Hi All, It's amazing isn't it how you can do the most fantastic stuff really easily yet when you go to do something that should be doable with a blindfold on it's really tricky. I'm trying to reboot a Nexus 7 in my code. I've ensured that it is rooted but still can't do it. I've tried the following two approaches and neither work Code: Copy ' Method 1 Dim objOperatingSystem As OperatingSystem : objOperatingSystem.Initialize("OS") objOperatingSystem.reboot("User requested reboot") ' Method 2 Dim objPhone As Phone objPhone.Shell("reboot",Null,Null,Null) The first method gives me an error about the user nor current process has reboot permissions (I added the reboot permission to the manifest). The second method gives me an error that says reboot operation not permitted Any suggestions would be very gratefully received! Regards, Jon
J joneden Active Member Licensed User Longtime User Feb 28, 2013 #2 Anyone have any thoughts on this? Regards Jon Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Feb 28, 2013 #3 Only system processes can get the REBOOT permission (at least on Android 4). Upvote 0
J joneden Active Member Licensed User Longtime User Feb 28, 2013 #4 Ah. So is there any fudge way to get a reboot to be performed - other than asking the user to do it manually? Is it possible to register a service as a system service? Regards, Jon Upvote 0
Ah. So is there any fudge way to get a reboot to be performed - other than asking the user to do it manually? Is it possible to register a service as a system service? Regards, Jon
Erel B4X founder Staff member Licensed User Longtime User Feb 28, 2013 #5 Your only option is to ask the user to reboot the device. Why do you need it? Upvote 0
J joneden Active Member Licensed User Longtime User Feb 28, 2013 #6 Ouch. Well I'm doing a Time and attendance application. I use the ZXing lib to get the user to show and have their barcode badge scanned. It works great but because sometimes I need to pull control back to the app (via a kiosk implementation) it seems that the ZXing lib isn't closing properly so I end up with memory leaks - that then slow the unit down. A reboot every few days would solve this. So it looks like I need to focus on resolving the memory leak issue. I've tried killing the ZXing process but when I look for it it isn't in the process list. Exiting the app then shows the ZXing window so it is definitely running I think that I ned to write some form of test app that will simplify the setup and allow me to do a more comprehensive test. Regards Jon Upvote 0
Ouch. Well I'm doing a Time and attendance application. I use the ZXing lib to get the user to show and have their barcode badge scanned. It works great but because sometimes I need to pull control back to the app (via a kiosk implementation) it seems that the ZXing lib isn't closing properly so I end up with memory leaks - that then slow the unit down. A reboot every few days would solve this. So it looks like I need to focus on resolving the memory leak issue. I've tried killing the ZXing process but when I look for it it isn't in the process list. Exiting the app then shows the ZXing window so it is definitely running I think that I ned to write some form of test app that will simplify the setup and allow me to do a more comprehensive test. Regards Jon
J joneden Active Member Licensed User Longtime User Feb 28, 2013 #7 Hi Erel, OK so I have cut the app right down to the bare minimum. When the app runs it has a clock in button, I press that, the ZXing screen shows up waiting for a barcode scan. When nothing happens for a few seconds my kiosk kicks in and pulls control back to the app. At this stage the app finds the com.srowen.bs.android process which is the one for the commercial version of ZXing. I use objOperatingSystem.killBackgroundProcesses("com.srowen.bs.android") to try and kill it but on checking it is still running. Then on closing my app I can see the ZXing window still running. If I had repeated the clock in and wait process 5 times, on exiting my app there would be 5 instances of the ZXing screen running. Any ideas why the killBackgroundProcess isn't working? Regards, Jon Upvote 0
Hi Erel, OK so I have cut the app right down to the bare minimum. When the app runs it has a clock in button, I press that, the ZXing screen shows up waiting for a barcode scan. When nothing happens for a few seconds my kiosk kicks in and pulls control back to the app. At this stage the app finds the com.srowen.bs.android process which is the one for the commercial version of ZXing. I use objOperatingSystem.killBackgroundProcesses("com.srowen.bs.android") to try and kill it but on checking it is still running. Then on closing my app I can see the ZXing window still running. If I had repeated the clock in and wait process 5 times, on exiting my app there would be 5 instances of the ZXing screen running. Any ideas why the killBackgroundProcess isn't working? Regards, Jon
J joneden Active Member Licensed User Longtime User Mar 1, 2013 #8 Hi again Erel OK so I figured out what was happening, I think that I was calling the kill background process procedure too soon after exiting form the process. I put into the clock event on the unit and it keeps trying to kill the process every 500 ms till it's gone. Works a treat now. Hopefully that bit of info may help someone with the same issue in the future. Back on the reboot question there must be a way to do it. I've used loads of apps that have a reboot option built into them. All the custom rom apps have it one way or another... Anyone have any ideas? Regards Jon Upvote 0
Hi again Erel OK so I figured out what was happening, I think that I was calling the kill background process procedure too soon after exiting form the process. I put into the clock event on the unit and it keeps trying to kill the process every 500 ms till it's gone. Works a treat now. Hopefully that bit of info may help someone with the same issue in the future. Back on the reboot question there must be a way to do it. I've used loads of apps that have a reboot option built into them. All the custom rom apps have it one way or another... Anyone have any ideas? Regards Jon
Erel B4X founder Staff member Licensed User Longtime User Mar 1, 2013 #9 I'm pretty sure that there is no way to programmatically reboot an unrooted Android 4 devices. Not sure about older devices. Upvote 0
I'm pretty sure that there is no way to programmatically reboot an unrooted Android 4 devices. Not sure about older devices.
J joneden Active Member Licensed User Longtime User Mar 1, 2013 #10 I just checked and taking Titanium backup as an example in the popup settings menu there is a reboot sub menu with two options, reboot device and reboot to recovery. Both work on my phone which runs 4.2.2 so the nexus should also do it. Now if I only I could figure out why my phone won't display log data I could see what it's doing for the reboot! Upvote 0
I just checked and taking Titanium backup as an example in the popup settings menu there is a reboot sub menu with two options, reboot device and reboot to recovery. Both work on my phone which runs 4.2.2 so the nexus should also do it. Now if I only I could figure out why my phone won't display log data I could see what it's doing for the reboot!
J joneden Active Member Licensed User Longtime User Mar 1, 2013 #11 Oh sorry - should have mentioned that both my phone and the nexus are rooted.... Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Mar 1, 2013 #12 You should execute the "reboot" command. There are several ways to do it. Either with a shell script or RootCmd library (search the forum). Upvote 0
You should execute the "reboot" command. There are several ways to do it. Either with a shell script or RootCmd library (search the forum).
J joneden Active Member Licensed User Longtime User Mar 1, 2013 #13 Thanks Erel, I had tried that yesterday but using the su command, using rootCmd with reboot works. For anyone else doing it there are two libs with the rootcmd, one of them requires a massive extra jar file that contains loads of samba stuff so go for the one by icefairy, taht one is small and works a treat. Regards Jon Upvote 0
Thanks Erel, I had tried that yesterday but using the su command, using rootCmd with reboot works. For anyone else doing it there are two libs with the rootcmd, one of them requires a massive extra jar file that contains loads of samba stuff so go for the one by icefairy, taht one is small and works a treat. Regards Jon