Android Question BroadCastReceiver - PROVIDERS_CHANGED

Discussion in 'Android Questions' started by sangee, Mar 1, 2018.

  1. sangee

    sangee Member Licensed User

    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)

    Sub Process_Globals
    Dim Broadcast As BroadCastReceiver
    End Sub

    Sub Service_Start (StartingIntent As Intent)
    'Listen for GPS on or off intent
    End Sub

    Sub BroadcastReceiver_OnReceive (Action As String)
    Log("GPS disabled")
    'can only abort when sendOrderedbroadcast is called.
    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.


  2. DonManfred

    DonManfred Expert Licensed User

    you did not Initialize the BCR! Put a
    as 1st line...

    Check the description in the BCR Library thread....
  3. sangee

    sangee Member Licensed User

    Sorry.. I had missed out on pasting that part of the code when posting this thread. I have already set the "initialize" in the Service create Sub like below

    Sub Service_Create
    If Notification.IsInitialized = False Then
    Notification.Icon = "icon"
    Notification.SetInfo("test""test", Main)
    Notification.Sound = False
    Notification.Vibrate = True
    End If
    End Sub
    The error is there even with this already. Not able to understand why trapping this intent is throwing error and causing the application to crash..
  4. Erel

    Erel Administrator Staff Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice