Android Question Service.StartForeground

Discussion in 'Android Questions' started by Laurie, Apr 14, 2019.

  1. Laurie

    Laurie Member Licensed User

    Could you provide a really simple example of starting a service.startforeground? I already have an app. What and where do I need to insert the service start?
     
  2. DonManfred

    DonManfred Expert Licensed User

  3. Laurie

    Laurie Member Licensed User

    I'm still confused and struggling to progress.
    Does my 'activity_create' code now go in 'service_create' ?
    Does the majority of my code now go into the equivalent of Tracker - and 'activity_create' in Main remain empty?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You should provide more information. Why do you need to have a foreground service?
     
  5. Laurie

    Laurie Member Licensed User

    Hi Erel, My app is a personal one to play our own music. It works fine but of course when the screen shuts down so does the music. I've seen the Tracker example but for a newby it is still difficult to figure out 'what goes where'.
    Some things that are easy, even obvious, to an expert are still tricky for new folks.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Add a new service to your app.
    Play the music from that service.
    Make it a foreground service.
    And acquire a partial lock with PhoneWakeState.
     
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