[Android] Connect VLC App to extensions service
Geoffrey Métais
git at videolan.org
Mon Dec 21 17:21:48 CET 2015
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 19 10:55:25 2015 +0100| [fe55ba65b8991e14935efa4e3ea4ac8b8b54335f] | committer: Geoffrey Métais
Connect VLC App to extensions service
> https://code.videolan.org/videolan/vlc-android/commit/fe55ba65b8991e14935efa4e3ea4ac8b8b54335f
---
.../src/org/videolan/vlc/gui/MainActivity.java | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 8f41a99..28c1954 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -22,8 +22,10 @@ package org.videolan.vlc.gui;
import android.annotation.TargetApi;
import android.app.SearchManager;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
@@ -32,6 +34,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Message;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
@@ -79,6 +82,7 @@ import org.videolan.vlc.interfaces.ISortable;
import org.videolan.vlc.media.MediaDatabase;
import org.videolan.vlc.media.MediaLibrary;
import org.videolan.vlc.media.MediaUtils;
+import org.videolan.vlc.plugin.PluginService;
import org.videolan.vlc.util.Permissions;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
@@ -257,6 +261,36 @@ public class MainActivity extends AudioPlayerContainerActivity implements Search
}
@Override
+ protected void onStart() {
+ super.onStart();
+// Log.d("VLC/PluginService", "binding service");
+// startService(new Intent(this, PluginService.class));
+ boolean connected = bindService(new Intent(MainActivity.this,
+ PluginService.class), mConnection, Context.BIND_AUTO_CREATE);
+ Log.d("VLC/PluginService", "binding service "+connected);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ unbindService(mConnection);
+ }
+
+ private PluginService mBoundService;
+
+ private ServiceConnection mConnection = new ServiceConnection() {
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ Log.d("VLC/PluginService", "onServiceConnected");
+ mBoundService = ((PluginService.LocalBinder)service).getService();
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {}
+ };
+
+ @Override
protected void onResume() {
super.onResume();
More information about the Android
mailing list