I've seen some examples in the forum but they don't seem to work with a Mxt Tablet.
I added to manifest and created a service named PhoneCalling started at the main activity startup.
Here's the code:
Has someone faced the same problem and got this to work ?
I added to manifest and created a service named PhoneCalling started at the main activity startup.
B4X:
AddPermission("android.permission.CALL_PHONE")
Here's the code:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim PE As PhoneEvents
End Sub
Sub Service_Create
PE.Initialize("PE")
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_Destroy
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Log("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber)
Log(Intent.ExtrasToString)
KillCall
End Sub
Sub KillCall
Dim r As Reflector
r.Target = r.GetContext
Dim TelephonyManager, TelephonyInterface As Object
TelephonyManager = r.RunMethod2("getSystemService", "phone", "java.lang.String")
r.Target = TelephonyManager
TelephonyInterface = r.RunMethod("getITelephony")
r.Target = TelephonyInterface
r.RunMethod("endCall")
End Sub
Has someone faced the same problem and got this to work ?