Hello,
I have the most simple service with the phone library:
The "started" appears in the log but when I ring nothing happens. I have added the permission:
AddPermission(android.permission.READ_PHONE_STATE)
and also tried AddPermission("android.permission.READ_PHONE_STATE")
It just simply is not raised althugh the service evidently starts. What do I have to do differently? Does it only work in rooted phones?
Thank you
Best regards
I have the most simple service with the phone library:
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
Dim pid As PhoneId
End Sub
Sub Service_Create
pe.InitializeWithPhoneState("PE", pid)
End Sub
Sub Service_Start (StartingIntent As Intent)
Log("started")
End Sub
Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub
'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Service_Destroy
pe.StopListening
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Log(State & " " & IncomingNumber)
End Sub
AddPermission(android.permission.READ_PHONE_STATE)
and also tried AddPermission("android.permission.READ_PHONE_STATE")
It just simply is not raised althugh the service evidently starts. What do I have to do differently? Does it only work in rooted phones?
Thank you
Best regards