MediaMonkey for Android dev docs: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
Line 11: Line 11:
This page contains information for developers who wish to interface with MediaMonkey for Android.
This page contains information for developers who wish to interface with MediaMonkey for Android.


== Intents ==
MMA have broadcast receiver to listen intents from external apps/remote devices. Intent must have action '''Intent.ACTION_MEDIA_BUTTON''' and external data  '''Intent.EXTRA_KEY_EVENT'''.


text...
 
== MMA will respond on these key codes: ==
 
KeyEvent.KEYCODE_HEADSETHOOK<br />
KeyEvent.KEYCODE_MEDIA_PLAY<br />
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE<br />
KeyEvent.KEYCODE_MEDIA_PAUSE<br />
KeyEvent.KEYCODE_MEDIA_NEXT<br />
KeyEvent.KEYCODE_MEDIA_PREVIOUS<br />
KeyEvent.KEYCODE_MEDIA_FAST_FORWARD<br />
KeyEvent.KEYCODE_MEDIA_REWIND:<br />
KeyEvent.KEYCODE_MEDIA_STOP:<br />
 
 
 
== Examples of use: ==
 
<source lang="java">
Intent intent = new Intent();
intent.setAction("android.intent.action.MEDIA_BUTTON");
intent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));
 
getActivity().sendOrderedBroadcast(intent, null);
 
intent = new Intent();
intent.setAction("android.intent.action.MEDIA_BUTTON");
intent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));
 
getActivity().sendOrderedBroadcast(intent, null);
</source>
 
'''Attention:''' Broadcast should be ordered.

Revision as of 11:49, 24 August 2015

MediaMonkey for Android Development Documentation

This page contains information for developers who wish to interface with MediaMonkey for Android.

MMA have broadcast receiver to listen intents from external apps/remote devices. Intent must have action Intent.ACTION_MEDIA_BUTTON and external data Intent.EXTRA_KEY_EVENT.


MMA will respond on these key codes:

KeyEvent.KEYCODE_HEADSETHOOK
KeyEvent.KEYCODE_MEDIA_PLAY
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
KeyEvent.KEYCODE_MEDIA_PAUSE
KeyEvent.KEYCODE_MEDIA_NEXT
KeyEvent.KEYCODE_MEDIA_PREVIOUS
KeyEvent.KEYCODE_MEDIA_FAST_FORWARD
KeyEvent.KEYCODE_MEDIA_REWIND:
KeyEvent.KEYCODE_MEDIA_STOP:


Examples of use:

Intent intent = new Intent();
intent.setAction("android.intent.action.MEDIA_BUTTON");
intent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));

getActivity().sendOrderedBroadcast(intent, null);

intent = new Intent();
intent.setAction("android.intent.action.MEDIA_BUTTON");
intent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));

getActivity().sendOrderedBroadcast(intent, null);

Attention: Broadcast should be ordered.