0

I am trying to open the camera from my app, however as there are other apps installed, such as candy and retrica , phone asks which one to open. However, I want to open the default camera, by default in every devices. Any solution? Here is my code:

public void cameraFuture(View view)
{
    Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(intent, 0);
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);
    ImageView iv = (ImageView)findViewById(R.id.camTemp);

    Bitmap bp = (Bitmap) data.getExtras().get("data");
    iv.setImageBitmap(bp);
}
OBX
  • 6,044
  • 7
  • 33
  • 77
  • have a look here https://developer.android.com/guide/components/intents-common.html at (Example intent filter). not sure but that category - default might work, although i haven't tried myself – Tasos Oct 10 '15 at 03:30
  • May be duplicate of *[How to restrict use of third party camera app from your app android-camera](http://stackoverflow.com/questions/31852200/how-to-restrict-use-of-third-party-camera-app-from-your-app)* – Alex Cohn Oct 10 '15 at 06:11

1 Answers1

0
  1. First of all get the package name of the camera you want to open by default .(if you need i will let you know how to get this)
  2. just write this code. change the package name you got for that camera - setPackage("place the new package name in here") method

    Intent mIntent = null; mIntent = new Intent(); mIntent.setPackage("com.sec.android.app.camera");
    mIntent.setAction(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); enter code herestartActivity(mIntent);