broadcast receiver for ACTION_CAMERA_BUTTON never gets called

試著忘記壹切 提交于 2019-11-29 11:56:12

You should either have the receiver registered in the manifest or register programmatically. Remove the registerReceiver() call from the onResume method.

Edit:
Add these to your manifest.

 <uses-permission android:name="android.permission.CAMERA" />
 <uses-feature android:name="android.hardware.camera" />

Your intent filter should never have a priority of 10000. The maximum allowed for user applications is 999.

See setPriority(int) on the AndroidDev website.

For opening the only the camera of your application you can use intent like:

Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(intent, ACTION_IMAGE_CAPTURE);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!