Commit df65474f authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Directly start service if context is an activity

parent c164267c
......@@ -21,6 +21,7 @@
package org.videolan.vlc;
import android.annotation.TargetApi;
......@@ -1878,7 +1879,8 @@ public class PlaybackService extends MediaBrowserServiceCompat{
public void connect() {
if (mBound) throw new IllegalStateException("already connected");
final Intent serviceIntent = getServiceIntent(mContext);
Util.startService(mContext, serviceIntent);
if (mContext instanceof Activity) mContext.startService(serviceIntent);
else Util.startService(mContext, serviceIntent);
mBound = mContext.bindService(serviceIntent, mServiceConnection, BIND_AUTO_CREATE);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment