Android Question /proc/stat (Permission denied) - MSOS Library

Discussion in 'Android Questions' started by Lucas Eduardo, Mar 1, 2019.

  1. Lucas Eduardo

    Lucas Eduardo Member Licensed User

    i was testing this lib https://www.b4x.com/android/forum/t...d-osstats-and-getforegroundapp.34954/#content
    on Android less than 8 is ok, but when I tested it on Android 8 I got this error
    in line
    Code:
    xOSStats.StartStats
    Code:
    ** Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    main_activity_resume (java line: 
    678)
    java.io.FileNotFoundException: /proc/stat (Permission denied)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:
    200)
        at java.io.FileInputStream.<init>(FileInputStream.java:
    150)
        at anywheresoftware.b4a.objects.streams.File.OpenInput(
    File.java:214)
        at anywheresoftware.b4a.objects.streams.File.ReadString(
    File.java:276)
        at b4a.example.osstats._readcpu(osstats.java:
    267)
        at b4a.example.osstats._startstats(osstats.java:
    325)
        at 
    msos.sample2.main._activity_resume(main.java:678)
        at java.lang.reflect.Method.invoke(Native Method)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    196)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    176)
        at 
    msos.sample2.main.afterFirstLayout(main.java:114)
        at 
    msos.sample2.main.access$000(main.java:21)
        at 
    msos.sample2.main$WaitForLayout.run(main.java:86)
        at android.os.Handler.handleCallback(Handler.java:
    790)
        at android.os.Handler.dispatchMessage(Handler.java:
    99)
        at android.os.Looper.loop(Looper.java:
    164)
        at android.app.ActivityThread.main(ActivityThread.java:
    7000)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:
    441)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    1408)
    i'm asking the permission PERMISSION_WRITE_EXTERNAL_STORAGE and to user allow me to use the usage stats PACKAGE_USAGE_STATS, but i still getting the error

    What permission could i ask to user?
     
  2. DonManfred

    DonManfred Expert Licensed User

    it depends on android.permission.GET_TASKS which is no longer available since lollipop
     
    Erel, OliverA and Lucas Eduardo like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice