I am trying to create a simple app that will run a bash script and then execute an app. The bash script does some downloads behind the scene that updates data for the app. However, I can not get it to work correctly. I know the bash script is functioning correctly because it works properly if I adb into the device and run it that way. Here is what I have thus far:
ADB into device and run: adb shell /sdcard/update.sh -
WORKS
Run script from app (code below) -
FAILS, DOES NOT GET NEEDED INFO
Here is my code from my Main activity:
Sub Activity_Create(FirstTime As Boolean)
Try
Dim update As Phone
Dim kodi As Intent
Dim pm As PackageManager
update.Shell("sh /sdcard/update.sh", Null, Null, Null)
Wait(10)
Msgbox ("Try it now", "")
Catch
ToastMessageShow ("Failed to launch app! Is it installed?", True)
End Try
Activity.Finish
End Sub
Sub Wait(Seconds As Int)
Dim Ti As Long
Ti = DateTime.Now + (Seconds * 1000)
Do While DateTime.Now < Ti
DoEvents
Loop
End Sub
And here is the code that calls it:
Sub Activity_Create(FirstTime As Boolean)
'This activity is REQUIRED but has to be left alone, you can name it whatever you want
'but the name MUST match the one in the manifest.
StartActivity(Main)
Activity.Finish
End Sub
I just started using B4A so I am sure I have something simple wrong, but can't figure it out..
The bash script I am running does some downloads, then executes another bash script on /sdcard/ but like I said, that all works if I use ADB to execute the script...