MediaMonkey for Android dev docs: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
 
(11 intermediate revisions by 3 users not shown)
Line 7: Line 7:
|}
|}


= 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.
 
== android.intent.action.MEDIA_BUTTON ==
 
Broadcast Action: 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, so it's important which player receives it first. <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:
 
* 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: '''
<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));
 
// ATTENTION: Broadcast should be ordered.
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));
 
// ATTENTION: Broadcast should be ordered.
sendOrderedBroadcast(intent, null);
</source>
 
== com.ventismedia.android.mediamonkey.ACTION_MEDIA_BUTTON ==
 
'''Note:''' Implemented since 1.1.3.468.
 
Broadcast Action: 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''' except that it avoids the problem of contention between players.
 
== com.ventismedia.android.mediamonkey.ACTION_START_SYNCHRONIZATION ==
 
Broadcast Action: Use it to start MMA wifi synchronization. Synchronization will start in the background but it can request user interaction via notifications (like delete and upload confirmations or sync server selection).  
 
''' Input:''' nothing <br />


== Intents ==
''' Output:''' nothing <br />


text...
''' Examples of use: '''
<source lang="java">
sendBroadcast(new Intent("com.ventismedia.android.mediamonkey.ACTION_START_SYNCHRONIZATION"));
</source>

Latest revision as of 18:21, 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

Broadcast Action: 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, so it's important which player receives it first.

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));

// ATTENTION: Broadcast should be ordered.
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)); 

// ATTENTION: Broadcast should be ordered.
sendOrderedBroadcast(intent, null);

com.ventismedia.android.mediamonkey.ACTION_MEDIA_BUTTON

Note: Implemented since 1.1.3.468.

Broadcast Action: 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 except that it avoids the problem of contention between players.

com.ventismedia.android.mediamonkey.ACTION_START_SYNCHRONIZATION

Broadcast Action: Use it to start MMA wifi synchronization. Synchronization will start in the background but it can request user interaction via notifications (like delete and upload confirmations or sync server selection).

Input: nothing

Output: nothing

Examples of use:

sendBroadcast(new Intent("com.ventismedia.android.mediamonkey.ACTION_START_SYNCHRONIZATION"));