code: private void registerLockScreenReceiver(Context context) {
          mLockScreenReceiver = new LockScreenReceiver();
          IntentFilter intentFilter = new IntentFilter();
          intentFilter.addAction(ACTION_TOGGLE_PLAYBACK);
          intentFilter.addAction(ACTION_NEXT_TRACK);
          intentFilter.addAction(ACTION_PREVIOUS_TRACK);
          mLocalBroadcastManager = LocalBroadcastManager.getInstance(context);
          mLocalBroadcastManager.registerReceiver(mLockScreenReceiver, intentFilter);
      }
docs: Register the lock screen receiver used to catch lock screen media buttons events.
  
  @param context holding context.