Android Question Wipe Entire Phone

SpinBower

Member
Licensed User
Longtime User
Hi, is there a way to programmatically wipe the users phone? I need this for a security app and it does not matter if it needs root access. Thanks!
 

SpinBower

Member
Licensed User
Longtime User
You won't be able to do that unless your app has SYSTEM permissions, and even so, a question might pop up asking the user to wipe data yes/no.

If you need to wipe the device you could use the Device Manager.
Is that the same as Device Administrator?
 
Upvote 0

SpinBower

Member
Licensed User
Longtime User
Oh, gotcha. Ok but isnt there a shell command that you can use with root access and it will wipe the device?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
You could use the Device Administrator Lib, but I believe it will wipe the device if the unlock password has been entered wrong X number of times, a shell command will still need system access.
 
Upvote 0

SpinBower

Member
Licensed User
Longtime User
You could use the Device Administrator Lib, but I believe it will wipe the device if the unlock password has been entered wrong X number of times, a shell command will still need system access.

Just if anyone wanted to know, I found the code use it with the Device Admin library:
B4X:
'wipe data
Dim r As Reflector
r.Target = admin
r.Target = r.GetField("dm")
r.RunMethod2("wipeData", 0, "java.lang.int")
 
Upvote 0

RAJAN MBA

Member
Licensed User
Longtime User
Just if anyone wanted to know, I found the code use it with the Device Admin library:
B4X:
'wipe data
Dim r As Reflector
r.Target = admin
r.Target = r.GetField("dm")
r.RunMethod2("wipeData", 0, "java.lang.int")
How did you test it? With emulator or a phone?
 
Upvote 0
Top