Java Code Examples for android.media.RemoteController#OnClientUpdateListener

The following examples show how to use android.media.RemoteController#OnClientUpdateListener . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoteControlKitKat.java    From Noyze with Apache License 2.0 6 votes vote down vote up
protected void registerController() {
    AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
    rController = new RemoteController(mContext, (RemoteController.OnClientUpdateListener) mContext);

    try {
        // This is a weird issue that needs more clarification.
        audioManager.registerRemoteController(rController);
    } catch (SecurityException se) {
        rController = null;
    }

    // By default an RemoteController.OnClientUpdateListener implementation will not receive bitmaps
    // for album art. Use setArtworkConfiguration(int, int) to receive images as well.
    if (null != rController) {
        Resources res = mContext.getResources();
        DisplayMetrics dm = res.getDisplayMetrics();
        final int dim = Math.max(dm.widthPixels, dm.heightPixels);
        rController.setArtworkConfiguration(dim, dim);
    }
}
 
Example 2
Source File: RemoteControlKitKat.java    From Noyze with Apache License 2.0 6 votes vote down vote up
protected void registerController() {
    AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
    rController = new RemoteController(mContext, (RemoteController.OnClientUpdateListener) mContext);

    try {
        // This is a weird issue that needs more clarification.
        audioManager.registerRemoteController(rController);
    } catch (SecurityException se) {
        rController = null;
    }

    // By default an RemoteController.OnClientUpdateListener implementation will not receive bitmaps
    // for album art. Use setArtworkConfiguration(int, int) to receive images as well.
    if (null != rController) {
        Resources res = mContext.getResources();
        DisplayMetrics dm = res.getDisplayMetrics();
        final int dim = Math.max(dm.widthPixels, dm.heightPixels);
        rController.setArtworkConfiguration(dim, dim);
    }
}
 
Example 3
Source File: MusicNotificationListenerService.java    From Android-RemoteController with Apache License 2.0 4 votes vote down vote up
public void setExternalClientUpdateListener(RemoteController.OnClientUpdateListener externalClientUpdateListener) {
    mExternalClientUpdateListener = externalClientUpdateListener;
}
 
Example 4
Source File: MediaService.java    From AcDisplay with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets up external callback for client update events.
 */
public void setClientUpdateListener(@Nullable RemoteController.OnClientUpdateListener listener) {
    mExternalListener = listener;
}