0

my Activty starts a service. (The service plays a media stream, but anyway). If I get with the back key, out of my activity, the service get killed.
The service is NOT bounded.

Here the stacktrace:

01-03 19:01:45.621: D/PlayerActivity(27221): button clicked
01-03 19:01:45.625: D/PlayerActivity(27221): haveInternet = true
01-03 19:01:45.636: D/PlayerActivity(27221): play
01-03 19:01:45.640: D/PlayerService(27221): onCreate Service
01-03 19:01:45.640: I/PlayerService(27221): Received start id 1: Intent { cmp=de.arvidg.onlineradio/.PlayerService }
01-03 19:01:45.644: D/PlayerService(27221): setAudiotStreamType
01-03 19:01:45.718: I/AwesomePlayer(123): setDataSource_l('http://listen.technobase.fm/tunein-dsl-pls')
01-03 19:01:45.718: D/PlayerService(27221): setDataSource
01-03 19:01:45.718: D/PlayerService(27221): prepareAsync
01-03 19:01:45.718: D/PlayerService(27221): onStartCommand
01-03 19:01:45.765: V/ChromiumHTTPDataSource(123): connect on behalf of uid 10058
01-03 19:01:45.765: I/ChromiumHTTPDataSource(123): connect to http://listen.technobase.fm/tunein-dsl-pls @0
01-03 19:01:50.078: D/PlayerService(27221): onPrepared
01-03 19:01:50.093: D/AudioHardware(123): AudioHardware pcm playback is exiting standby.
01-03 19:01:50.093: D/AudioHardware(123): openPcmOut_l() mPcmOpenCnt: 0
01-03 19:05:44.996: D/PlayerActivity(27221): onPause
01-03 19:05:44.996: D/PlayerActivity(27221): mpState = 1 01-03 19:05:45.070: W/InputManagerService(193): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4169d040 (uid=10058 pid=27221) 01-03 19:05:45.672: I/ActivityManager(193): No longer want de.arvidg.onlineradio (pid 27221): hidden #1
01-03 19:05:45.703: W/ActivityManager(193): Scheduling restart of crashed service de.arvidg.onlineradio/.PlayerService in 480134ms
01-03 19:05:45.703: I/WindowManager(193): WIN DEATH: Window{416e3580 de.arvidg.onlineradio/de.arvidg.onlineradio.StartActivity paused=false}
01-03 19:05:45.707: W/TimedEventQueue(123): Event 238 was not found in the queue, already cancelled?
01-03 19:05:45.707: W/AudioFlinger(123): session id 165 not found for pid 123
01-03 19:05:48.711: D/AudioHardware(123): AudioHardware pcm playback is going to standby.
01-03 19:05:48.711: D/AudioHardware(123): closePcmOut_l() mPcmOpenCnt: 1
01-03 19:05:55.691: W/ActivityManager(193): Activity destroy timeout for ActivityRecord{416d47d8 de.arvidg.onlineradio/.StartActivity}
01-03 19:05:56.332: I/wpa_supplicant(434): wlan0: WPA: Group rekeying completed with 14:d6:4d:cb:2f:44 [GTK=TKIP]
01-03 19:06:41.515: D/dalvikvm(193): GC_CONCURRENT freed 1473K, 23% free 16567K/21511K, paused 21ms+9ms

What is AwesomePlayer?! Its NOT my tag ... Can anyone help? It makes me crazy, I can't get it working since 2 days ...

Leandros
  • 16,805
  • 9
  • 69
  • 108
  • Solved it myself. setForeground() ! – Leandros Jan 03 '12 at 19:54
  • Possible duplicate of [Android Background Service is restarting when application is killed](http://stackoverflow.com/questions/15452935/android-background-service-is-restarting-when-application-is-killed) – Martin Tournoij Aug 26 '16 at 20:34

1 Answers1

0

Solved it myself, with setForeground()

Leandros
  • 16,805
  • 9
  • 69
  • 108