MediaMonkey for Android dev docs: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
No edit summary
Line 6: Line 6:
| style="font-size:95%; padding:10px 0; margin:0px; text-align: right; white-space:nowrap; color:#000;" | [[Special:Statistics|{{NUMBEROFARTICLES}}]] articles '''·''' [[Special:Allpages|Article Index]]
| style="font-size:95%; padding:10px 0; margin:0px; text-align: right; white-space:nowrap; color:#000;" | [[Special:Statistics|{{NUMBEROFARTICLES}}]] articles '''·''' [[Special:Allpages|Article Index]]
|}
|}
= MediaMonkey for Android Development Documentation  =


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 has broadcast receivers to listen for intents from external apps/remote devices.


== Intents ==
== android.intent.action.MEDIA_BUTTON ==
 
MMA has a broadcast receiver to listen for intents from external apps/remote devices.
 
Intents must have '''Intent.ACTION_MEDIA_BUTTON''' or '''com.ventismedia.android.mediamonkey.MEDIA_BUTTON_ACTION''' action and external data  '''Intent.EXTRA_KEY_EVENT'''.<br />
Note that '''Intent.ACTION_MEDIA_BUTTON''' is a common action which is also received by other players and it's therefore important which player receives it as first. Alternatively, the '''com.ventismedia.android.mediamonkey.MEDIA_BUTTON_ACTION''' action is received only by MMA, and it's usage is the same as for '''Intent.ACTION_MEDIA_BUTTON''' (Implemented since 1.1.3.0468).


This intent is sent when media button is pressed and you can use it to control MMA playback. This intent can control other Android players too.  <br/>


 
'''Input:''' Includes a single extra field, [http://developer.android.com/reference/android/content/Intent.html#EXTRA_KEY_EVENT EXTRA_KEY_EVENT], containing the [http://developer.android.com/reference/android/view/KeyEvent.html KeyEvent] that caused this event. MMA will respond on these key codes:
=== MMA will respond on these key codes: ===
    
    
KeyEvent.KEYCODE_HEADSETHOOK<br />
* KeyEvent.KEYCODE_HEADSETHOOK
KeyEvent.KEYCODE_MEDIA_PLAY<br />
* KeyEvent.KEYCODE_MEDIA_PLAY
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE<br />
* KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
KeyEvent.KEYCODE_MEDIA_PAUSE<br />
* KeyEvent.KEYCODE_MEDIA_PAUSE
KeyEvent.KEYCODE_MEDIA_NEXT<br />
* KeyEvent.KEYCODE_MEDIA_NEXT
KeyEvent.KEYCODE_MEDIA_PREVIOUS<br />
* KeyEvent.KEYCODE_MEDIA_PREVIOUS
KeyEvent.KEYCODE_MEDIA_FAST_FORWARD<br />
* KeyEvent.KEYCODE_MEDIA_FAST_FORWARD
KeyEvent.KEYCODE_MEDIA_REWIND:<br />
* KeyEvent.KEYCODE_MEDIA_REWIND
KeyEvent.KEYCODE_MEDIA_STOP:<br />
* KeyEvent.KEYCODE_MEDIA_STOP


''' Output: ''' nothing


 
''' Examples of use: '''
=== Examples of use: ===
 
<source lang="java">
<source lang="java">
Intent intent = new Intent();
Intent intent = new Intent();
Line 53: Line 47:


'''Attention:''' Broadcast should be ordered.
'''Attention:''' Broadcast should be ordered.
== com.ventismedia.android.mediamonkey.ACTION_MEDIA_BUTTON ==
'''Note:''' Implemented since 1.1.3.468.
This intent has exactly the same usage as '''android.intent.action.MEDIA_BUTTON''' but it is received only by MMA. It is an alternative to '''android.intent.action.MEDIA_BUTTON''' which is also received by other players and it's therefore important which player receives it as first.
== com.ventismedia.android.mediamonkey.ACTION_START_SYNCHRONIZATION ==
Service intent: Use it to start MMA wifi synchronization. This synchronization will start on background but it can request user interaction via notifications (like delete and upload confirmations or sync server selection).
''' Input:''' nothing <br />
''' Output:''' nothing <br />

Revision as of 10:19, 25 August 2015

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

Intents

MMA has broadcast receivers to listen for intents from external apps/remote devices.

android.intent.action.MEDIA_BUTTON

This intent is sent when media button is pressed and you can use it to control MMA playback. This intent can control other Android players too.

Input: Includes a single extra field, EXTRA_KEY_EVENT, containing the KeyEvent that caused this 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

Output: nothing

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.

com.ventismedia.android.mediamonkey.ACTION_MEDIA_BUTTON

Note: Implemented since 1.1.3.468.

This intent has exactly the same usage as android.intent.action.MEDIA_BUTTON but it is received only by MMA. It is an alternative to android.intent.action.MEDIA_BUTTON which is also received by other players and it's therefore important which player receives it as first.

com.ventismedia.android.mediamonkey.ACTION_START_SYNCHRONIZATION

Service intent: Use it to start MMA wifi synchronization. This synchronization will start on background but it can request user interaction via notifications (like delete and upload confirmations or sync server selection).

Input: nothing

Output: nothing