Other Error in specific device MOTO G3 (3gr) informed by GooglePlay

desof

Well-Known Member
Licensed User
Longtime User
My application is working on most devices but without a hitch on my own does not work the call option since it returns me error the following line

B4X:
ub LLAMAR (Numero As String,Nombre As String,Domicilio As String  )
    Dim ph As Phone
    Dim bd As BitmapDrawable
    Dim tmpValue As String

    bd = ph.GetResourceDrawable(17301659)'17301659 = ic_dialog_info
    tmpValue="Teléfono: " & Numero &  CRLF & "Nombre: " & Nombre & CRLF & "Domicilio: " & Domicilio

    If Numero = "" Then
        ToastMessageShow("Número no válido", False)
        Return
    End If
       
    result=Msgbox2(tmpValue,"","Llamar","Cancelar","",bd.Bitmap)

    If result=DialogResponse.POSITIVE Then
        SendCall (Numero)
    Else
        'Msgbox("NO HACER NADA","")
    End If
End Sub

Sub SendCall(PhoneNumber As String)
    Dim p As PhoneCalls
    StartActivity(p.Call(PhoneNumber))
End Sub

I included the catch error that google play offers me

wEppMg7Lv.png
 

desof

Well-Known Member
Licensed User
Longtime User
See this tutorial: Runtime Permissions (Android 6.0+ Permissions)

Note that you must use runtime permissions now. It is not possible to revert back to a lower version after the app was submitted to Google Play.

xQboyDjmG.png

Hello Erel I was trying to understand this from the permissions and reading your reference post.
My application then using these permissions I show in the attached image.

1- So I must ask the users of Android 6 + truth?

2- Can I request these permissions when entering the system the first time?

3- And then they are not solita more the same?
 
Upvote 0

desof

Well-Known Member
Licensed User
Longtime User
Please help something I am doing wrong because I get error and it is not possible to run the application correctly.
I have recreated the problem in this simple project where the Manifest has the same minimum and maximum SDK as my real app and develop a method for granting permissions when starting the application.

I attach the code

https://dl.dropboxusercontent.com/u/53113728/TEST_PERMISOS.rar

xXw0H0Oo4.png
 
Upvote 0

desof

Well-Known Member
Licensed User
Longtime User
[Quote = "eps, post: 483259, miembros: 10372"] de depuración o de rastreo debe ser su primer puerto de escala [/ quote]
B4X:
Copying updated assets files (1)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 54 (Main)
java.lang.RuntimeException: Cannot parse:  as boolean
    at anywheresoftware.b4a.BA.parseBoolean(BA.java:557)
    at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:627)
    at b4a.example.permisos.main._activity_create(main.java:383)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at b4a.example.permisos.main.afterFirstLayout(main.java:102)
    at b4a.example.permisos.main.access$000(main.java:17)
    at b4a.example.permisos.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5001)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
 
  • Like
Reactions: eps
Upvote 0

eps

Expert
Licensed User
Longtime User
Cool, so what is here "Error occurred on line: 54 (Main)"

java.lang.RuntimeException: Cannot parse: as boolean
 
Upvote 0

desof

Well-Known Member
Licensed User
Longtime User
Sorry but I do not understand.
How would the code please


B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    If FirstTime=True Then
        If Activity_PermissionResult(rp.PERMISSION_CALL_PHONE ,False) Then
            ToastMessageShow(" Yea Autorizado",True)
        Else
            ToastMessageShow(" no Autorizado",True)       
        End If
       
'        If Activity_PermissionResult(rp.PERMISSION_READ_EXTERNAL_STORAGE  ,False) Then
'            ToastMessageShow(" Yes Autorizado",True)
'        Else
'            ToastMessageShow(" no Autorizado",True)
'        End If
    End If   

End Sub
   
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
    If Permission = rp.PERMISSION_CALL_PHONE Then
        rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE)
        Result=True
    Else If Permission = rp.PERMISSION_READ_EXTERNAL_STORAGE Then
        rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
        Result=True
    End If
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

desof

Well-Known Member
Licensed User
Longtime User
You DID read Erels post???? Seems you did not.
You DID read Erels post???? Seems you did not.
I read absolutely everything and try to understand what the translator gives me since I do not use their language.
I make more effort and his words are offensive to me because we are not all so capable of assimilating things in the same way.
With a simple code example correctly is the best way to help it seems to me.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Although my Spanish is at best very basic.... Someone else may well be able to help. There's this, which is also linked to in the link above https://developer.android.com/guide/topics/permissions/index.html

Have you tried asking here? https://www.b4x.com/android/forum/forums/spanish-forum.12/

You need to do something like the code in the link(s) above, e.g.

This is an optional feature. It is only relevant if android:targetSdkVersion is set to 23 or above.

B4X:
Sub Activity_Create(FirstTime As Boolean)
      Activity.LoadLayout("1") ' or whatever

      rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE)

     ' rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
End Sub

Sub Activity_PermissionResult (Permission AsString, Result As Boolean)
      If Permission = rp.PERMISSION_CALL_PHONE Then
           gmap.MyLocationEnabled = Result
      EndIf
End Sub


Although from the link, thanks to @Erel for this.

"
The dangerous permissions are marked with * (in B4A v6+).
You don't need to ask for non-dangerous permissions.

READ_EXTERNAL_STORAGE / WRITE_EXTERNAL_STORAGE

This is the most common dangerous permission. It is added automatically when you use File.DirDefaultExternal or File.DirRootExternal.
However there is a simple workaround for this.

1. Use RuntimePermissions.GetSafeDirDefaultExternal("") instead of File.DirDefaultExternal. The parameter passed is an optional subfolder that will be created under the default folder.

2. Add this code to the manifest editor:
Code:
AddManifestText(
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
)
The explanation for this is that GetSafeDirDefaultExternal doesn't require any permission on Android 4.4+ (API 18) and requires the WRITE_EXTERNAL_STORAGE on older versions. The code above adds the permission to older devices.

You only need to deal with WRITE_EXTERNAL_STORAGE at runtime if you need access to a folder other than the app's default external folder.
"
 
Upvote 0

desof

Well-Known Member
Licensed User
Longtime User
Hello
Thank you very much for your help.
I have solved the subject at last after much trying and trying.
I do not understand some cures with respect to the manifest
AddManifestText(
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
)
because without embargo in my app do not put the code indicated by EREL and it is working properly since I have uploaded the app to PlaySotre and try on several devices and apparently it is ok.
I want to start a miniturorial with this case in Spanish
Do you think you can be welcome =?
 
Upvote 0
Top