Programmatically click on button camera Android -


i need program click on android camera button on tablet, code, , works fine, need done program; thank much.

private void sacofotoingresolocal() {      intent takepictureintent = new intent(mediastore.action_image_capture);     // ensure there's camera activity handle intent     if (takepictureintent.resolveactivity(getpackagemanager()) != null) {         // create file photo should go         file photofile = null;         try {             photofile = createimagefile();         } catch (ioexception ex) {             // error occurred while creating file          }         // continue if file created         if (photofile != null) {             uri photouri = fileprovider.geturiforfile(this,"com.example.android.fileprovider",  photofile);             takepictureintent.putextra(mediastore.extra_output, photouri);             startactivityforresult(takepictureintent, requerimeinto_tomar_foto);          }     } } 

there no "camera button" on devices, including tablets. moreover, cannot fake user input (hardware or software), obvious security reasons.

if want take photo without user involvement, use camera apis directly, or use third-party library wrap them (e.g., camerakit-android, fotoapparat).


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -