title: How to access camera from natively compiled c++ binary in Android
body: <p>I have been experimenting to access the camera with Android C++ native API. But instead of including the binary inside an APK, I just compiled the code into an executable and pushed into the device using ADB. The binary is placed inside /data/local/tmp directory and executed from <code>adb shell</code>.</p>
  
  <p>But i am unable to access the camera, is there any permission that i am missing? or does Android make it forbidden to use camera directly from an executable?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include &lt;camera/NdkCameraManager.h&gt;
  
  int main(){
      printf("Camera Manager\n");
      ACameraManager *cameraManager = ACameraManager_create();
      ACameraIdList *cameraIds = nullptr;
      ACameraManager_getCameraIdList(cameraManager, &amp;cameraIds);
      printf("Number of camera %d\n", cameraIds-&gt;numCameras);
      //deleting the camera manager
      ACameraManager_delete(cameraManager);
      printf("Deleted the camera\n");  
  }
  </code></pre>
  
  <p>The above code always print 0 as the number of camera</p>