diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/android/packaging/xbmc/AndroidManifest.xml.in | 12 | ||||
-rw-r--r-- | tools/android/packaging/xbmc/src/org/xbmc/kodi/Main.java.in | 15 |
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) |