Java app check root on device - Java for Android App Development

Hi,
I hope it is fine to post my question here and if not I am sorry. I want to implement a simple java app running on Desktop - Not in device, to check whether connected android device is rooted. Simply it will output a text message. I need help to accomplish this. Android device is connected to the PC over USB and USB debugging is enabled. How to check from my app device is rooted.
Many Thanks

Have a look at some open sourced root checker apps

iua said:
Hi,
I hope it is fine to post my question here and if not I am sorry. I want to implement a simple java app running on Desktop - Not in device, to check whether connected android device is rooted. Simply it will output a text message. I need help to accomplish this. Android device is connected to the PC over USB and USB debugging is enabled. How to check from my app device is rooted.
Many Thanks
Click to expand...
Click to collapse
Can u tell me the android version of your phone and os running on your pc..
Meanwhile u can try installing unlock root or kingo app on pc
which tells u about root status of connected device and helps u root it too.
Sent from my Galaxy S4 using XDA Premium 4 mobile app

You could add the adb executable to your app and run adb shell commands as described here: http://stackoverflow.com/questions/20922600/execute-adb-command-from-java-program
The "su" executable does not work on devices which aren't rooted. That would be a way to check whether the device is rooted.

Hi,
Thank you very much. I achieved it by using a simple bash script. When it runs return root success or not.
Many thanks for helps

Related

[Q] Eclipse - Can't connect my device with Eclipse

Sorry If it will be a very "easy" question, but I'm only a beginner, so, please be patient
I made a small application, and I tried to put in ads with AdMob. I tried to connect my device to the Eclipse, so I can run on it the progrmam, and see the logcat, because when I'm installed it to my device it doesn't show any ads. I tried to plug in it, but Eclipse doesn't show my device on the device chooser panel. I checked the USB debugging on my phone. What can I do? Thanks for help!
HUNZwiebel said:
Sorry If it will be a very "easy" question, but I'm only a beginner, so, please be patient
I made a small application, and I tried to put in ads with AdMob. I tried to connect my device to the Eclipse, so I can run on it the progrmam, and see the logcat, because when I'm installed it to my device it doesn't show any ads. I tried to plug in it, but Eclipse doesn't show my device on the device chooser panel. I checked the USB debugging on my phone. What can I do? Thanks for help!
Click to expand...
Click to collapse
Do you have the Android SDK installed and properly set up in Eclipse?
Did you do any updates on Eclipse or the sdk recently? Did you move the sdk? You can always bypass Eclipse and try identifying your device using adb to see if there is a problem on that end
From something awesome
If you use Windows you have to install the phone's drivers. On linux follow this tutorial on installing a device for development: Using Hardware Devices

4.2.2 adb device offline

I have fresh installed N7 3g 4.2.2
adb devices show me "device offline" on Linux.
Do anybody help me solve?
AW: 4.2.2 adb device offline
It's a New security feature: in your device a popup with a hash key should be shown asking you whether you would allow the PC to connect to your device. After accepting that, the device can be accessed from the PC.
Sent from my Nexus 7 using xda app-developers app
AndDiSa said:
It's a New security feature: in your device a popup with a hash key should be shown asking you whether you would allow the PC to connect to your device. After accepting that, the device can be accessed from the PC.
Sent from my Nexus 7 using xda app-developers app
Click to expand...
Click to collapse
Thank you for answer. But I don't see popup window.
I install TWRP. Then in recovery mode install root access.
Now I can use local shell via android terminal with su.
Code:
setprop ro.adb.secure 0
getprop ro.adb.secure
1
How to change this property?
seting in /system/build.prop didn't help
Solved. Latest adb installed. Popup fingerprint window appeared.
svs57 said:
Solved. Latest adb installed. Popup fingerprint window appeared.
Click to expand...
Click to collapse
sorry for noob question but how you update your adb?
Yeh how do you update adb, is it through sdk manager
Sent from my Nexus 7 using XDA Premium HD app
azfarmiera said:
sorry for noob question but how you update your adb?
Click to expand...
Click to collapse
Download the android adb fastboot files in this thread link and if usb debugging is enabled and you connect your phone to you computer you should get a pop-up on your phone. It worked for me
http://forum.xda-developers.com/showthread.php?t=2144709
Also I think I opened the fastboot.exe and adb.exe files too
I couldn't update through SDK manager, t just kept popping alert that I need dependant lib, so I just uninstalled whole SDK and installed again, worked like a charm.
azfarmiera said:
sorry for noob question but how you update your adb?
Click to expand...
Click to collapse
To update ADB use SDK Manager.
For some reason the SDK Manager does not automatically show the new release versions of Android SDK Tools and Android Platform-Tools, so if the versions of your Android SDK Tools and/or Android Platform-Tools are respectively older than 21.1 and 16.0.1, you will need to first delete them then reload the SDK Manager to get their new release versions to be displayed and available for installation.
Also, it appears that Android Support Libraries (under Extra) is also required for ADB to work, so you should install it as well.
Also, to get ADB-over-WiFi to work, first use ADB-over-USB to the same given PC/Laptop and grant access with "always" box checked.
digixmax said:
To update ADB use SDK Manager.
For some reason the SDK Manager does not automatically show the new release versions of Android SDK Tools and Android Platform-Tools, so if the versions of your Android SDK Tools and/or Android Platform-Tools are respectively older than 21.1 and 16.0.1, you will need to first delete them then reload the SDK Manager to get their new release versions to be displayed and available for installation.
Also, it appears that Android Support Libraries (under Extra) is also required for ADB to work, so you should install it as well.
Also, to get ADB-over-WiFi to work, first use ADB-over-USB to the same given PC/Laptop and grant access with "always" box checked.
Click to expand...
Click to collapse
So is version 21.1 and 16.0.1 the latest of their builds? And if I install those, I will not have a problem with the adb being offline?
Leonhan said:
So is version 21.1 and 16.0.1 the latest of their builds? And if I install those, I will not have a problem with the adb being offline?
Click to expand...
Click to collapse
I use Android Debug Bridge version 1.0.31.
http://developer.android.com/sdk/index.html
http://dl.google.com/android/adt/adt-bundle-linux-x86.zip
Leonhan said:
So is version 21.1 and 16.0.1 the latest of their builds? And if I install those, I will not have a problem with the adb being offline?
Click to expand...
Click to collapse
They are the latest version and solved the problem for me.
Sent from my Nexus 7 using XDA Premium HD app

[Q] root.bat closes upon first key stroke. Help needed!

I am trying to root my D802 device according to the following thread.
http://forum.xda-developers.com/showthread.php?t=2448887
I can find my device with adb devices. good. Then leaving the cmd window open, I double click root.bat: a new window pops up asking me to press any key. Doing so immediately closes the root.bat window and of course doesn't root the device. Does anyone has any clue what's wrong?
I have D802. Windows xp. Installed usb drivers. Enabled debugging mode.
I have tried to run the bat as administrator as well as limited privilege user. No difference.
PLEASE HELP!!!!
Same Problem
I am having same exact issue..windows 7 would love some help on this! Just need root for adblock and I am set this device rocks! +rid bloatware but thats a given.
eadred said:
I am trying to root my D802 device according to the following thread.
http://forum.xda-developers.com/showthread.php?t=2448887
I can find my device with adb devices. good. Then leaving the cmd window open, I double click root.bat: a new window pops up asking me to press any key. Doing so immediately closes the root.bat window and of course doesn't root the device. Does anyone has any clue what's wrong?
I have D802. Windows xp. Installed usb drivers. Enabled debugging mode.
I have tried to run the bat as administrator as well as limited privilege user. No difference.
PLEASE HELP!!!!
Click to expand...
Click to collapse
Well, glad to not be the only one. Let's find what we have in common, maybe we'll find where it comes from. Do you also have windows xp? Have you by any chance windowblinds installed? Have you run as administrator? Anything particular otherwise?
Same Problem
I have Windows 7 and no windows blinds...I have tried different ports and also ran as administrator. I have successfully rooted OG Droid, Droid Bionic , and Galaxy Nexus. I think I got spoiled by how easy the Nexus was to root and change roms. Love the G2 just need to get the root to stick. Every time I hit a key to continue from root bat the command window closes. I was able to read quickly a line that says unknown error has occured. Not sure why this is happening. I have tried two different drivers LG VZW_United_WHQL_v2.11.1.exe and LGUnitedMobileDriver.exe with no luck.
Using the application usbdeview, I can't see the lg driver even though I have installed it. Is it the same for you?
Actually a lg driver is indeed listed
LGE Android Phone AndroidNet Sooner Single ADB Interface Vendor Specific No Yes No No 02231cddcf4eb680 19.10.2013 19:25:05 19.10.2013 23:37:42 1004 631f 2.32 ff 42 01 andnetadb ADB Interface DriverNet lgandnetadb.sys USB Google, Inc AndroidNet Sooner Single ADB Interface 3.10.0.0 USB\Vid_1004&Pid_631f\02231cddcf4eb680
Same Problem
The drivers say installed correctly......in the command window after you check adb devices it comes back with model number and more numbers. When it looks for the device and carrier I get /f was unexpected at the time. Thinking about uninstalling all the drivers and trying for the umteenth time. You running any virus protection wonder if that has any effect?
maclv said:
The drivers say installed correctly......in the command window after you check adb devices it comes back with model number and more numbers. When it looks for the device and carrier I get /f was unexpected at the time. Thinking about uninstalling all the drivers and trying for the umteenth time. You running any virus protection wonder if that has any effect?
Click to expand...
Click to collapse
Not sure what you mean. On my side, if I write adb devices in a command prompt, I only get one line of numbers and beside it: 'device'. And that's it. Do you get additonal infos?
When I run the root.bat, I can hardly read the text before it closes, but from what I saw and completing with the text that you can get by editing the root.bat, I tend to think that the following is written before it closes:
Looking for device...
.\adb.exe wait-for-device
Determining carrier...
On a chat before, someone suggested me to right click the root.bat and clic edit to view the content of the bat. And then manualy reproduce in adb by pushing the necessary files and such... But I haven't yet given hope that it works with the bat. But maybe you feel like giving it a shot.
I have ESET as antivirus
Same Problem
No luck manual editing the root bat. When I type adb device it list VS980_4G - and a set of numbers
I was wondering if I should try another root method. I have seen on an italian forum someone who rooted with a chinese method. I have no time right now, but I might test it in a few days.
http://translate.google.com/transla...&hl=en&langpair=auto|en&tbb=1&ie=windows-1252
Btw in which country are you? I bought my mobile phone from digitec in switzerland.
I bought mine from Verizon in the US. Deleted all previous drivers....trying fresh install see if that helps
Sent from my VS980 4G using Tapatalk
maclv said:
I bought mine from Verizon in the US. Deleted all previous drivers....trying fresh install see if that helps
Sent from my VS980 4G using Tapatalk
Click to expand...
Click to collapse
please let me know if you get through. I'm stuck and willing to return the device. it's killing me
Tried on another computer. Was done within second. It will remain a mystery why it didn't work on mine. But hey, done is done! :good:
I will try on another cpu hmmmm
Sent from my VS980 4G using Tapatalk
hit windows key+r,enter cmd then hit run.
then navigate via cd c:\folder\folderthatcontainsroot.bat
then open root.bat by typing it in cmd.
that should stop tje autoclosing of cmd when opening via windows Explorer.
Sent from my LG-D802
Thank you for the tip. I was able to get root switching to a different cpu. .but glad I will be able to use my main cpu in the future. Thank you both for the help.
Sent from my VS980 4G using Tapatalk

[Root Tool] Cydia Impactor! UPDATE 02/01/14

Cydia Impactor​
How it works?
It used the Master key exploit to drop SuperSU binary, if the master key exploit does not work it will attempt to use another Signature Bug found in Android.
What is the Master Key Exploit?
The Master Key Exploit was discovered by BlueBox Security, it can modify the contents of an application package without affecting the cryptographic signatures.
Would it work on Your Xperia?
If you are running anything below 4.4 KitKat then Yes this would work on Your Xperia!
If you have the Xposed Master Key Exploit Patch this will not work.
And On Stock KitKat it may or may not work (Not Tested)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Download: http://www.cydiaimpactor.com/
Enable USB Debugging, Then Run the Program and click Start and then Install SuperSU from the Play Store!
Say Thanks because your Rooted!
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UPDATE:
Not Working on Xperia Z on Android 4.2 and Above, Firmware .244 & Above
Sony Xperia Z with stock 4.3 - no device found.
Sony Xperia Z Ultra Stock 4.3 - Signature bugs unavailable
tried on Xperia Z stock 4.3
Code:
signature bugs unavailable
themonyo said:
tried on Xperia Z stock 4.3
Code:
signature bugs unavailable
Click to expand...
Click to collapse
Getting the same error. For those facing device not found error, check your phone for a dialogue to provide access to the app. Too bad this doesn't work, would have been great for the Xperia Z on Android 4.3.
Ereckson said:
Getting the same error. For those facing device not found error, check your phone for a dialogue to provide access to the app. Too bad this doesn't work, would have been great for the Xperia Z on Android 4.3.
Click to expand...
Click to collapse
It is because the master key exploit is patched by Sony as early as .244(4.2) firmware (if I remember correctly)
Not working on Dell Venue 7 with Intel Atom processor and Android 4.3
Cydia Impactor On Hanspree HSG1279 Tablet
UltraGamerHD said:
Cydia Impactor​
How it works?
It used the Master key exploit to drop SuperSU binary, if the master key exploit does not work it will attempt to use another Signature Bug found in Android.
What is the Master Key Exploit?
The Master Key Exploit was discovered by BlueBox Security, it can modify the contents of an application package without affecting the cryptographic signatures.
Would it work on Your Xperia?
If you are running anything below 4.4 KitKat then Yes this would work on Your Xperia!
If you have the Xposed Master Key Exploit Patch this will not work.
And On Stock KitKat it may or may not work (Not Tested)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Download: http://www.cydiaimpactor.com/
Enable USB Debugging, Then Run the Program and click Start and then Install SuperSU from the Play Store!
Say Thanks because your Rooted!
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UPDATE:
Not Working on Xperia Z on Android 4.2 and Above, Firmware .244 & Above
Click to expand...
Click to collapse
How do you install the program. Tried to run it with the tablet connected to PC via USB. Clicked on impactor.exe, clicked start and all I get is "no device found". I am able to copy the Impactor folder to the tablet internal and external sdcard and run impactor.exe but I get no device found.
I am on Android version 4.2.2. Any ideas?
AHLASSICH said:
How do you install the program. Tried to run it with the tablet connected to PC via USB. Clicked on impactor.exe, clicked start and all I get is "no device found". I am able to copy the Impactor folder to the tablet internal and external sdcard and run impactor.exe but I get no device found.
I am on Android version 4.2.2. Any ideas?
Click to expand...
Click to collapse
Enable USB Debugging and install drivers!
Then just hit start and Install SuperSU!
Cydia Impactor On Hanspree HSG1279 Tablet
AHLASSICH said:
How do you install the program. Tried to run it with the tablet connected to PC via USB. Clicked on impactor.exe, clicked start and all I get is "no device found". I am able to copy the Impactor folder to the tablet internal and external sdcard and run impactor.exe but I get no device found.
I am on Android version 4.2.2. Any ideas?
Click to expand...
Click to collapse
Thank you UltraGamerHD. Enabling USB is a given. Like I mentioned, I was able to copy to both internal and external sd cards from my PC. I think that means USB is enabled. I guess you install Impactor on the PC, plug the tablet into USB and make sure USB is enabled and then run the impacter.exe. I still get device not found error. I also tried installing SuperUser SU using an UPDATE.zip thru the recovery mode. It appeared to run just fine then heartbreak, I got "Installation Aborted". :crying: Several people have gotten root so I know it can be done. At the moment, nothing is working for me. The only thing I haven't tried is the ADB approuch. I don't know how to use it. I have JS Terminal from the app store installed. Maybe someone can give me a link to step by step input instructions for using the terminal to get root.
Side question: I installed ES File Explorer and I am able to open the system folder and see xbin and open xbin. I see busybox and sqlite3 amoung other files in the xbin folder. I do not see an su file though. I thought you could not open system without root. Do I have root and not know it? Anybody have any idea whats going on with my tablet? I am running windows 8.1 on my PC. I don't know if that is relavant or not.
AHLASSICH said:
Thank you UltraGamerHD. Enabling USB is a given. Like I mentioned, I was able to copy to both internal and external sd cards from my PC. I think that means USB is enabled. I guess you install Impactor on the PC, plug the tablet into USB and make sure USB is enabled and then run the impacter.exe. I still get device not found error. I also tried installing SuperUser SU using an UPDATE.zip thru the recovery mode. It appeared to run just fine then heartbreak, I got "Installation Aborted". :crying: Several people have gotten root so I know it can be done. At the moment, nothing is working for me. The only thing I haven't tried is the ADB approuch. I don't know how to use it. I have JS Terminal from the app store installed. Maybe someone can give me a link to step by step input instructions for using the terminal to get root.
Side question: I installed ES File Explorer and I am able to open the system folder and see xbin and open xbin. I see busybox and sqlite3 amoung other files in the xbin folder. I do not see an su file though. I thought you could not open system without root. Do I have root and not know it? Anybody have any idea whats going on with my tablet? I am running windows 8.1 on my PC. I don't know if that is relavant or not.
Click to expand...
Click to collapse
"If you are on Windows, you may have to install a device driver to talk to your device over USB. If your device is not detected, use Impactor's USB Driver Scan feature to attempt to automatically construct and install a driver for your device".
AHLASSICH said:
I thought you could not open system without root.
Click to expand...
Click to collapse
You can read, but not write to the system partition if you're not rooted.
My device shows up in device manager and I have usb debuging on but it keeps saying device not found?
Anyone tried this on Z1 (534 firmware)?
It should (theoretically) work...
Sent from my C6903 using Tapatalk
Any help would be greatly appreciated.
slaveinc said:
Any help would be greatly appreciated.
Click to expand...
Click to collapse
You need to install ADB Drivers. Google Universal ADB drivers and you should find it. I think you might be able to use the driver package provided by Flashtool.
Sent from my C1505 using Tapatalk
UltraGamerHD said:
You need to install ADB Drivers. Google Universal ADB drivers and you should find it. I think you might be able to use the driver package provided by Flashtool.
Sent from my C1505 using Tapatalk
Click to expand...
Click to collapse
I will try that. Thanks.
---------- Post added at 04:13 PM ---------- Previous post was at 04:07 PM ----------
It says they are already installed. It shows up in device manager.
slaveinc said:
I will try that. Thanks.
---------- Post added at 04:13 PM ---------- Previous post was at 04:07 PM ----------
It says they are already installed. It shows up in device manager.
Click to expand...
Click to collapse
Enable USB Debugging
Sent from my C1505 using Tapatalk
UltraGamerHD said:
Cydia Impactor​
How it works?
It used the Master key exploit to drop SuperSU binary, if the master key exploit does not work it will attempt to use another Signature Bug found in Android.
What is the Master Key Exploit?
The Master Key Exploit was discovered by BlueBox Security, it can modify the contents of an application package without affecting the cryptographic signatures.
Would it work on Your Xperia?
If you are running anything below 4.4 KitKat then Yes this would work on Your Xperia!
If you have the Xposed Master Key Exploit Patch this will not work.
And On Stock KitKat it may or may not work (Not Tested)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Download: http://www.cydiaimpactor.com/
Enable USB Debugging, Then Run the Program and click Start and then Install SuperSU from the Play Store!
Say Thanks because your Rooted!
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UPDATE:
Not Working on Xperia Z on Android 4.2 and Above, Firmware .244 & Above
Click to expand...
Click to collapse
AWESOME!!! Run great on my Yifang M7000NBD or Amlogic Next7HD8G (NX007HD8G) whatever!!
works with xperis sp?
anyone tried?

[Q] Enabling USB Debugging in ROM Over USB on a rooted, unlocked, running CWR

Hey guys. My phone slipped out my pocket and the digitizer is broken. My phone is rooted, the boot loader is unlocked, and I have it recognised as an ADB Recovery device. I want to enable USB Debugging so I can use androidscreencast to use my phone over my PC so I can set it up to push notifications to my computer and to my pebble(smart watch).
How can I do this. Most of the threads I have found just flat out don't work or stop because of some sort of restriction due to the phone being still locked.
It looks like you need to run some commands in a terminal emulator on your phone. Which in your case is going to be impossible. Why don't you just use adb pull to pull the data off your sdcard?
Sent from my Nexus 5 using XDA Free mobile app
jd1639 said:
It looks like you need to run some commands in a terminal emulator on your phone. Which in your case is going to be impossible. Why don't you just use adb pull to pull the data off your sdcard?
Sent from my Nexus 5 using XDA Free mobile app
Click to expand...
Click to collapse
Don't need any of the stuff - I could just boot in and take it over USB. All I need is to enable USB Debugging to send touch commands in place of my touch screen. Once I have that my pebble can let me use my phone outside of the house and I can send notifications to my PC too.
Bump!
Bump!
Anyone? I can't get a new phone for a while.
The biggest Problem ist the Drivers "FOR ALL"problems
You must have all Drivers for it
ThePraeceps said:
Hey guys. My phone slipped out my pocket and the digitizer is broken. My phone is rooted, the boot loader is unlocked, and I have it recognised as an ADB Recovery device. I want to enable USB Debugging so I can use androidscreencast to use my phone over my PC so I can set it up to push notifications to my computer and to my pebble(smart watch).
How can I do this. Most of the threads I have found just flat out don't work or stop because of some sort of restriction due to the phone being still locked.
Click to expand...
Click to collapse
R-2-D-2 said:
You must have all Drivers for it
Click to expand...
Click to collapse
Drivers are installed for it too, I literally just need to get USB Debugging
I am in exactly the same boat! I just need to enable debugging so i can remote control my Nexus 4. i have adb access from CWM, in case there is any commands i can do from there?
Roguecube said:
I am in exactly the same boat! I just need to enable debugging so i can remote control my Nexus 4. i have adb access from CWM, in case there is any commands i can do from there?
Click to expand...
Click to collapse
Hey man. Ultimately I just got a new screen but I was able to enable usb debugging with these instructions.
Hope it helps!
http://stackoverflow.com/questions/13326806/enable-usb-debugging-through-clockworkmod-with-adb

Categories

Resources