title: Android 7 JobScheduler get event when new picture is taken by the camera
body: <p>I have a problem on Android 7 that not support the broadcast event "android.hardware.action.NEW_PICTURE" longer. I write now for Android 7 a JobService but it will not fire when a Picture is shot by the internal camera.
  I don't know what is the problem, can everybody help me.</p>
  
  <p>If any example source in the www that's for Android 7 and JobService for the replacement the broadcast  <strong>"android.hardware.action.NEW_PICTURE"</strong> .</p>
  
  <p><strong><em>Thanks for help !</em></strong></p>
  
  <p>Here is my example Code:</p>
  
  <pre><code>  @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
  public class ZNJobService extends JobService {
     private static Zlog log = new Zlog(ZNJobService.class.getName());
  
      static final Uri MEDIA_URI = Uri.parse("content://" + MediaStore.AUTHORITY + "/");
      static final int ZNJOBSERVICE_JOB_ID = 777;
      static  JobInfo JOB_INFO;
  
  
      @RequiresApi(api = Build.VERSION_CODES.N)
      public static boolean isRegistered(Context pContext){
  
              JobScheduler js = pContext.getSystemService(JobScheduler.class);
              List&lt;JobInfo&gt; jobs = js.getAllPendingJobs();
              if (jobs == null) {
                  log.INFO("ZNJobService not registered ");
                  return false;
              }
              for (int i = 0; i &lt; jobs.size(); i++) {
                  if (jobs.get(i).getId() == ZNJOBSERVICE_JOB_ID) {
                      log.INFO("ZNJobService is registered :-)");
                      return true;
                  }
              }
              log.INFO("ZNJobService is not registered");
              return false;
  
      }
  
  
      public static void registerJob(Context pContext){
  
          Log.i("ZNJobService","ZNJobService init");
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.N ) {
  
              if (! isRegistered(pContext)) {
                  Log.i("ZNJobService", "JobBuilder executes");
                  log.INFO("JobBuilder executes");
                  JobInfo.Builder builder = new JobInfo.Builder(ZNJOBSERVICE_JOB_ID, new ComponentName(pContext, ZNJobService.class.getName()));
                  // Look for specific changes to images in the provider.
                  builder.addTriggerContentUri(new JobInfo.TriggerContentUri(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                                                                             JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS));
                  // Also look for general reports of changes in the overall provider.
                  //builder.addTriggerContentUri(new JobInfo.TriggerContentUri(MEDIA_URI, 0));
                  JOB_INFO = builder.build();
                  log.INFO("JOB_INFO created");
  
                  JobScheduler scheduler = (JobScheduler) pContext.getSystemService(Context.JOB_SCHEDULER_SERVICE);
                  int result = scheduler.schedule(JOB_INFO);
                  if (result == JobScheduler.RESULT_SUCCESS) {
                      log.INFO(" JobScheduler OK");
                  } else {
                      log.ERROR(" JobScheduler fails");
                  }
              }
  
          } else {
              JOB_INFO = null;
          }
      }
  
  
      @RequiresApi(api = Build.VERSION_CODES.N)
      @Override
      public boolean onStartJob(JobParameters params) {
          log.INFO("onStartJob");
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.N) {
              if (params.getJobId() == ZNJOBSERVICE_JOB_ID) {
                  if (params.getTriggeredContentAuthorities() != null) {
  
                      for (Uri uri : params.getTriggeredContentUris()) {
                          log.INFO("JobService Uri=%s",uri.toString());
                      }
  
                  }
              }
          }
          this.jobFinished(params,false);
          return false;
      }
  
      @Override
      public boolean onStopJob(JobParameters params) {
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.N) {
              log.INFO("onStopJob");
          }
          return true;
  
      }
  }
  </code></pre>