@Override
  public void handleMessage(Message message) {
    if (message == null) {
      return;
    }

    AppOpsManager appOpsManager =
        (AppOpsManager)
            googlePlayReceiver.getApplicationContext().getSystemService(Context.APP_OPS_SERVICE);
    try {
      appOpsManager.checkPackage(message.sendingUid, GooglePlayDriver.BACKEND_PACKAGE);
    } catch (SecurityException e) {
      Log.e(TAG, "Message was not sent from GCM.");
      return;
    }

    switch (message.what) {
      case MSG_START_EXEC:
        handleStartMessage(message);
        break;

      case MSG_STOP_EXEC:
        handleStopMessage(message);
        break;

      case MSG_INIT:
        // Not implemented.
        break;

      default:
        Log.e(TAG, "Unrecognized message received: " + message);
        break;
    }
  }
A messenger for communication with GCM Network Scheduler.
jobdispatcher/src/main/java/com/firebase/jobdispatcher/GooglePlayMessageHandler.java