aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris "Koying" Browet <cbro@semperpax.com>2015-07-20 15:59:42 +0200
committerChris "koying" Browet <cbro@semperpax.com>2015-10-29 13:37:21 +0100
commit54018e9d208be6aeff8b99d09e832b9ff83684aa (patch)
tree3c0ca933bceddad6bb185f71e88fb71f7a7817ad /tools
parentec8f051a6e56b3748d30fdaee8e08391fa904648 (diff)
CHG: [droid] proper handling of MEDIA keys
This allows MEDIA key to control Kodi when minimized
Diffstat (limited to 'tools')
-rw-r--r--tools/android/packaging/xbmc/AndroidManifest.xml.in12
-rw-r--r--tools/android/packaging/xbmc/src/org/xbmc/kodi/Main.java.in15
2 files changed, 27 insertions, 0 deletions
diff --git a/tools/android/packaging/xbmc/AndroidManifest.xml.in b/tools/android/packaging/xbmc/AndroidManifest.xml.in
index c10630b99c..924fe1fbd1 100644
--- a/tools/android/packaging/xbmc/AndroidManifest.xml.in
+++ b/tools/android/packaging/xbmc/AndroidManifest.xml.in
@@ -82,6 +82,18 @@
android:name="android.app.lib_name"
android:value="@APP_NAME_LC@" />
</activity>
+
+ <receiver android:name=".XBMCBroadcastReceiver" >
+ <intent-filter>
+ <action android:name="android.intent.action.BATTERY_CHANGED" />
+ <action android:name="android.intent.action.DREAMING_STOPPED" />
+ <action android:name="android.intent.action.SCREEN_ON" />
+ <action android:name="android.intent.action.HEADSET_PLUG" />
+ <action android:name="android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED" />
+ <action android:name="android.intent.action.MEDIA_BUTTON" />
+ </intent-filter>
+ </receiver>
+
</application>
</manifest><!-- END_INCLUDE(manifest) -->
diff --git a/tools/android/packaging/xbmc/src/org/xbmc/kodi/Main.java.in b/tools/android/packaging/xbmc/src/org/xbmc/kodi/Main.java.in
index 8b1848396a..d2399b43c9 100644
--- a/tools/android/packaging/xbmc/src/org/xbmc/kodi/Main.java.in
+++ b/tools/android/packaging/xbmc/src/org/xbmc/kodi/Main.java.in
@@ -1,6 +1,7 @@
package org.xbmc.@APP_NAME_LC@;
import android.app.NativeActivity;
+import android.content.ComponentName;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Bundle;
@@ -61,6 +62,20 @@ public class Main extends NativeActivity
}
});
}
+
+ public void registerMediaButtonEventReceiver()
+ {
+ Log.d(TAG, "registerMediaButtonEventReceiver");
+ AudioManager manager = (AudioManager) getSystemService(AUDIO_SERVICE);
+ manager.registerMediaButtonEventReceiver(new ComponentName(getPackageName(), XBMCBroadcastReceiver.class.getName()));
+ }
+
+ public void unregisterMediaButtonEventReceiver()
+ {
+ Log.d(TAG, "unregisterMediaButtonEventReceiver");
+ AudioManager manager = (AudioManager) getSystemService(AUDIO_SERVICE);
+ manager.unregisterMediaButtonEventReceiver(new ComponentName(getPackageName(), XBMCBroadcastReceiver.class.getName()));
+ }
@Override
public void onCreate(Bundle savedInstanceState)