Android Question Permission denied

pgargom

Member
Licensed User
Longtime User
Hi¡
i am developing an app wich have to work without human contact, therebefore,i turn of device with a VNC where i have to do a reboot command in a terminal. This app works with a service wich comunicates with a pic microcontroller.

On the other hand, i have other app wich start on boot the device, and 30 seconds later, it have to turn on the first app.

First problem that i have.. is that first app dont wait 30 seconds to turn on, it turn on when boot the device(i think that it happen because his service isnt stopped, and he force to start the app when it call some module.). Then, when i reboot a device.. dont kill apps and his services? if it is the problem, how i can to detect that device goes to turn of to stop service?

The second problem is that i have next error in first app when it turn on(only when i reboot the device. if i stop app and then execute, it works ok.)
NOTE: this error only happened in release mode. In debbug mode it works ok¡¡

B4X:
I/B4A    (  295): ~e:java.io.FileNotFoundException: /mnt/sdcard/MuralShopping/Configuracion/Configuracion.txt: open failed: EACCES (Permission denied)
I/B4A    (  295): ~e:    at libcore.io.IoBridge.open(IoBridge.java:406)
I/B4A    (  295): ~e:    at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
I/B4A    (  295): ~e:    at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:348)
I/B4A    (  295): ~e:    at anywheresoftware.b4a.objects.streams.File.WriteString(File.java:246)
I/B4A    (  295): ~e:    at b4aSlave.example.otros._crearestructuradirectorios(otros.java:398)
I/B4A    (  295): ~e:    at b4aSlave.example.main._activity_create(main.java:478)
I/B4A    (  295): ~e:    at java.lang.reflect.Method.invokeNative(Native Method)
I/B4A    (  295): ~e:    at java.lang.reflect.Method.invoke(Method.java:511)
I/B4A    (  295): ~e:    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
I/B4A    (  295): ~e:    at b4aSlave.example.main.afterFirstLayout(main.java:98)
I/B4A    (  295): ~e:    at b4aSlave.example.main.access$100(main.java:16)
I/B4A    (  295): ~e:    at b4aSlave.example.main$WaitForLayout.run(main.java:76)
I/B4A    (  295): ~e:    at android.os.Handler.handleCallback(Handler.java:605)
I/B4A    (  295): ~e:    at android.os.Handler.dispatchMessage(Handler.java:92)
I/B4A    (  295): ~e:    at android.os.Looper.loop(Looper.java:137)
I/B4A    (  295): ~e:    at android.app.ActivityThread.main(ActivityThread.java:4424)
I/B4A    (  295): ~e:    at java.lang.reflect.Method.invokeNative(Native Method)
I/B4A    (  295): ~e:    at java.lang.reflect.Method.invoke(Method.java:511)
I/B4A    (  295): ~e:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
I/B4A    (  295): ~e:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
I/B4A    (  295): ~e:    at dalvik.system.NativeStart.main(Native Method)
I/B4A    (  295): ~e:Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
I/B4A    (  295): ~e:    at libcore.io.Posix.open(Native Method)
I/B4A    (  295): ~e:    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
I/B4A    (  295): ~e:    at libcore.io.IoBridge.open(IoBridge.java:390)
I/B4A    (  295): ~e:    ... 20 more
I/B4A    (  295): ~e:java.io.FileNotFoundException: /mnt/sdcard/MuralShopping/Configuracion/Configuracion.txt: open failed: EACCES (Permission denied)


could you help me?
sorry for my English¡¡
Thanks¡¡
 

pgargom

Member
Licensed User
Longtime User
This is the code, and the directory ""MuralShopping" exist. This only happened in release mode:

B4X:
'Método para construir la estructura de los directorios contenedores de la aplicacion
Public Sub crearEstructuraDirectorios
    If File.Exists(File.DirRootExternal,"MuralShopping") = False Then
        File.MakeDir(File.DirRootExternal, "MuralShopping")
        File.MakeDir(File.DirRootExternal&"/MuralShopping/", "Recursos")
        File.MakeDir(File.DirRootExternal&"/MuralShopping/", "BD")
        File.MakeDir(File.DirRootExternal&"/MuralShopping", "Configuracion")
        File.WriteString(File.DirRootExternal&"/MuralShopping/Configuracion","Configuracion.txt","Archivo de configuracion")
        File.MakeDir(File.DirRootExternal&"/MuralShopping","Tests")
    End If
End Sub


if i reboot my device with VNC. then when device turn on, and i perform command "ps" on terminal, my app its executing. Should be its ok? or my app should be die?
 
Upvote 0

pgargom

Member
Licensed User
Longtime User
The device still doesn´t mount the directory when app trying to acces it after reboot.
Thanks¡
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…