I am using MediaBrowserServiceCompat in my app to play music. I am also starting service with startService method within the service and also using startForeground with notification as well as using wakelock require. But still my service is being destroyed after lock.
startService(new Intent(getApplicationContext(),
PlaybackService.class));
mService.startForeground(NOTIFICATION_ID, notification);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
mWakeLock.acquire();