AddPermission(android.permission.CALL_PRIVILIGED)
Dim Tel As String
SQL1.Initialize(DBDir,DBArk,True)
RS1=SQL1.ExecQuery("SELECT * FROM telefoni WHERE id = " & iIDTelefono & ";")
Do While RS1.NextRow
Tel = RS1.GetString("telefono")
Loop
SQL1.close
Dim result As Int
result=Msgbox2("Vuoi telefonare al numero " & Tel & "?","Telefonata","SI","","NO",Null)
If result=DialogResponse.Positive Then
Dim i As Intent
i.Initialize(i.ACTION_CALL, "+39" & Tel)
StartActivity(i)
End If
Il metodo è sicuramente ineccepibile, però che ci staremmo a fare noi??(Io suggerisco di digitare il numero dalla tastiera, la telefonata parte lo stesso)
Sarà sicuro la mancanza di qualche permesso, ma non ho trovato niente in linea che mi possa aiutare a mettere qualche idea più chiara nella mia testa.Quale errore? Non sarà la mancanza di qualche permesso?
Fammi vedere l'errore che ti segnalaIl metodo è sicuramente ineccepibile, però che ci staremmo a fare noi??
Sarà sicuro la mancanza di qualche permesso, ma non ho trovato niente in linea che mi possa aiutare a mettere qualche idea più chiara nella mia testa.
Secondo te quali permessi è necessario invocare?
Ecco:Fammi vedere l'errore che ti segnala
Non sono un esperto ma questo permesso ?Ecco:
Error occurred on line: 359 (Contatto)
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxx flg=0x20000 cmp=com.android.server.telecom/.components.UserCallActivity } from ProcessRecord{9fc146a 13352:b4a.personaltools/u0a250} (pid=13352, uid=10250) with revoked permission android.permission.CALL_PHONE
at android.os.Parcel.createExceptionOrNull(Parcel.java:2385)
at android.os.Parcel.createException(Parcel.java:2369)
at android.os.Parcel.readException(Parcel.java:2352)
at android.os.Parcel.readException(Parcel.java:2294)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:4276)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1723)
at android.app.Activity.startActivityForResult(Activity.java:5377)
at android.app.Activity.startActivityForResult(Activity.java:5335)
at android.app.Activity.startActivity(Activity.java:5721)
at android.app.Activity.startActivity(Activity.java:5674)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:857)
at b4a.personaltools.contatto._ltel_longclick(contatto.java:1314)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$2.onLongClick(ViewWrapper.java:90)
at android.view.View.performLongClickInternal(View.java:8240)
Private Sub lTel_LongClick
iIDTelefono=iIDTel(clvTelefoni.GetItemFromView(Sender))
SQL1.Initialize(DBDir,DBArk,True)
RS1=SQL1.ExecQuery("SELECT * FROM telefoni WHERE id = " & iIDTelefono & ";")
Do While RS1.NextRow
Tel = RS1.GetString("telefono")
Loop
SQL1.close
Dim ro As Object = Msgbox2Async("Vuoi telefonare al numero " & Tel & "?","Telefona al contatto","SI","","NO",Null,False)
Wait For (ro) Msgbox_Result (res As Int)
If res=DialogResponse.POSITIVE Then
Telefona
End If
End Sub
Private Sub Telefona
rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE)
Wait For Activity_PermissionResult(Permission As String, Result As Boolean)
Log(Permission)
Log(Result)
If Result=True Then
Log(Tel)
Tel="+39" & Tel
Dim ph As PhoneCalls
StartActivity(ph.Call(Tel))
Else
Log("No permesso")
End If
End Sub
rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE)
Wait For Activity_PermissionResult(Permission As String, Result As Boolean)
SiUtilizzi per caso b4xpage?
Private Sub lTel_LongClick
iIDTelefono=iIDTel(clvTelefoni.GetItemFromView(Sender))
SQL1.Initialize(DBDir,DBArk,True)
RS1=SQL1.ExecQuery("SELECT * FROM telefoni WHERE id = " & iIDTelefono & ";")
Do While RS1.NextRow
Tel = RS1.GetString("telefono")
Loop
SQL1.close
Dim ro As Object = Msgbox2Async("Vuoi telefonare al numero " & Tel & "?","Telefona al contatto","SI","","NO",Null,False)
Wait For (ro) Msgbox_Result (res As Int)
If res=DialogResponse.POSITIVE Then
rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE)
Wait For Activity_PermissionResult(Permission As String, Result As Boolean)
End If
End Sub
Private Sub B4XPage_Permissionresult(Permission As String,Result As Boolean)
If Result=True Then
Tel="+39" & Tel
Dim ph As PhoneCalls
StartActivity(ph.Call(Tel))
End If
End Sub
Grandissimo Xfood, ho risolto in questo modo:
Grazie a tuttiB4X:Private Sub lTel_LongClick iIDTelefono=iIDTel(clvTelefoni.GetItemFromView(Sender)) SQL1.Initialize(DBDir,DBArk,True) RS1=SQL1.ExecQuery("SELECT * FROM telefoni WHERE id = " & iIDTelefono & ";") Do While RS1.NextRow Tel = RS1.GetString("telefono") Loop SQL1.close Dim ro As Object = Msgbox2Async("Vuoi telefonare al numero " & Tel & "?","Telefona al contatto","SI","","NO",Null,False) Wait For (ro) Msgbox_Result (res As Int) If res=DialogResponse.POSITIVE Then rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE) Wait For Activity_PermissionResult(Permission As String, Result As Boolean) End If End Sub Private Sub B4XPage_Permissionresult(Permission As String,Result As Boolean) If Result=True Then Tel="+39" & Tel Dim ph As PhoneCalls StartActivity(ph.Call(Tel)) End If End Sub
rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
toast.Show("No permission!")
Return
End If
Tel="+39" & Tel
Dim ph As PhoneCalls
StartActivity(ph.Call(Tel))
'Startactyvity in b4xpage non dovrebbe ssere usato cosi
B4XPages.ShowPageAndRemovePreviousPages("calltel")
Tutto questo lo metti in B4XPage_Permissionresult?Piu o meno e cosi,
B4X:rp.CheckAndRequest(rp.PERMISSION_CALL_PHONE) Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean) If Result = False Then toast.Show("No permission!") Return End If Tel="+39" & Tel Dim ph As PhoneCalls StartActivity(ph.Call(Tel)) 'Startactyvity in b4xpage non dovrebbe ssere usato cosi B4XPages.ShowPageAndRemovePreviousPages("calltel")
Creo progettino semplice e condivido... quando puoi va beneSe post il progettino appena ho un pc lo controllo, ma se na parla sabato
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?