Android Question How to disable background service [solved]

Discussion in 'Android Questions' started by Didier9, Apr 29, 2019.

  1. Didier9

    Didier9 Active Member Licensed User

    I made the mistake of installing the example in
    https://www.b4x.com/android/forum/threads/background-location-tracking.99873/

    Even though I removed the program, rebooted the phone, added this code
    Code:
    Sub Activity_KeyPress( KeyCode As Int ) As Boolean ' Return True to consume the event
        If KeyCode = 4 Then ' back key
            CancelScheduledService( Me )
            
    Activity.Finish
        
    End If
        
    Return True
    End Sub ' Activity_KeyPress()
    to hopefully cancel the service before exiting the app, it still comes back after a while.
    After exiting the app, the phone is quiet for 5-10 minutes then invariably it starts buzzing again while showing the Tracking Location event.

    How can I get rid of this thing?

    TIA...
     
  2. ronell

    ronell Well-Known Member Licensed User

    i think it should be
    Code:
    CancelScheduledService(Tracker) 'service module
    instead of
    Code:
    CancelScheduledService( Me ) 'activity module
     
    Didier9 and Erel like this.
  3. Didier9

    Didier9 Active Member Licensed User

    Thank you! Erel was right, that thing will not stop for anything :)
     
Loading...
  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