title: Android auto take picture
body: <p>I am working on app that is suppose to take a selfie every 20 minutes without the user interface or user pressing something. I start this job using a <code>JobScheduler</code> and I create a notification that tells the user that my app is working. I've managed to take a slefie but it needs user's action and preview and I do not want this. I just simply want to take a selfie without the preview or user pressing a button.</p>
  
  <pre><code>private void pic()
  {
      Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      startActivityForResult(camera,7);
  }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          Log.d("bine","true");
          if (requestCode == 7)
          {
              Log.d("bine","true");
              Bitmap photo = (Bitmap) data.getExtras().get("data");
              img.setImageBitmap(photo);
          }
      }
  </code></pre>
  
  <p>P.S: I am working with android 9!</p>