Hello All,
I am trying an option in my new app to detect when the user disables the GPS. Code is as below (took from the example)
This is triggering error when I switch on or off the GPS (location on/off) in the settings.
The error is below.. Can anyone let me know how to detect when a user switches on/off the GPS.
Regards,
Sangee
I am trying an option in my new app to detect when the user disables the GPS. Code is as below (took from the example)
B4X:
Sub Process_Globals
Dim Broadcast As BroadCastReceiver
End Sub
Sub Service_Start (StartingIntent As Intent)
'Listen for GPS on or off intent
Broadcast.addAction("android.location.PROVIDERS_CHANGED")
Broadcast.SetPriority(2147483647)
Broadcast.registerReceiver("")
End Sub
Sub BroadcastReceiver_OnReceive (Action As String)
ToastMessageShow(Action,False)
Log("GPS disabled")
'can only abort when sendOrderedbroadcast is called.
'Broadcast.AbortBroadcast
End Sub
This is triggering error when I switch on or off the GPS (location on/off) in the settings.
The error is below.. Can anyone let me know how to detect when a user switches on/off the GPS.
Regards,
Sangee
java.lang.Exception: Sub broadcastreceiver_onreceive signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:171)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at com.rootsoft.broadcastreceiver.BroadCastReceiver$1.onReceive(BroadCastReceiver.java:110)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:881)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.location.GPS_ENABLED_CHANGE flg=0x10 (has extras) } in com.rootsoft.broadcastreceiver.BroadCastReceiver$1@a8fd6b3
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:891)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.RuntimeException: java.lang.Exception: Sub broadcastreceiver_onreceive signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:206)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at com.rootsoft.broadcastreceiver.BroadCastReceiver$1.onReceive(BroadCastReceiver.java:110)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:881)
... 7 more
Caused by: java.lang.Exception: Sub broadcastreceiver_onreceive signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:171)
... 10 more