Delete other app's data

spajky123

New Member
what? Im asking for a code how to do it.

I tried with code I collected on this forum

Dim FilesToDelete As List

FilesToDelete.Initialize
FilesToDelete.AddAll(File.ListFiles("/data/data/com.android.bluetooth"))

For i = 0 To FilesToDelete.Size -1

File.Delete("/data/data/com.android.bluetooth", FilesToDelete.Get(i))

Next
If File.Delete("/data/data/com.android.bluetooth", "") = True Then
Msgbox("folder deleted", "")
Else
Msgbox("NOT deleted", "")
End If

but it says object should be 1st initalized (list)
 
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The File.ListFiles documentation says that a uninitialized list is returned if the folder is inaccessible. Check the folders address. Or maybe you don't have permission.

Sent using Tapatalk
 
Upvote 0

spajky123

New Member
no, my phone is rooted, I added SU permissions, and I tried to File.Exists (path) and it returns it exist. Maybe I need to mount as RW?

Mine whole code:


Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim OS As OperatingSystem
Dim BT As BluetoothAdmin
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Activity.LoadLayout("BT")
BT.Initialize ("BT")

End Sub
Sub BT_StateChanged (NewState As Int, OldState As Int)
Dim Command, Runner As String
Dim StdOut, StdErr As StringBuilder
Dim Result As Int
Dim Ph As Phone
StdOut.Initialize
StdErr.Initialize
If NewState = 10 AND OldState = 11 Then
Runner = File.Combine(File.DirInternalCache, "runner")
Command = File.Combine(File.DirInternalCache, "command")
File.WriteString(File.DirInternalCache, "runner", "su < " & Command)
File.WriteString(File.DirInternalCache, "command", "mount -o remount,rw /system")
Result = Ph.Shell("sh", Array As String(Runner), StdOut, StdErr)
Msgbox(StdOut.tostring, "") ' got nothing
Dim FilesToDelete As List
FilesToDelete.Initialize
FilesToDelete.AddAll(File.ListFiles("/data/data/com.android.bluetooth"))
For i = 0 To FilesToDelete.Size -1
File.Delete("/data/data/com.android.bluetooth", FilesToDelete.Get(i))
Next
OS.killBackgroundProcesses ("com.android.bluetooth")
Msgbox("Hi!", "")
End If
End Sub

and I got object not initalized (list)
 
Last edited:
Upvote 0
Top