开发者

ContentObserver for Camera Button?

开发者 https://www.devze.com 2023-03-30 22:34 出处:网络
I have tried to detect when camera button is pressed using Broadcastreceiver but it doesn\'t work, and I don\'t understand why (maybe my phone is the problem). Now, I want to know if is it possible to

I have tried to detect when camera button is pressed using Broadcastreceiver but it doesn't work, and I don't understand why (maybe my phone is the problem). Now, I want to know if is it possible to do this using ContentObserver. Is possible开发者_StackOverflow社区? If yes, can you give me an example...

Thanks in advance..


BroadcastReceiver, not ContentObserver.

<receiver android:name=".CameraButtonBroadcastReceiver">
    <intent-filter>
        <action android:name="android.intent.action.CAMERA_BUTTON"/>
    </intent-filter>
</receiver>

You should implement CameraButtonBroadcastReceiver class, which is a subclass of BroadcastReceiver.


I am not 100% positive on this but the camera button might be one of those intent that cannot be declared in the manifest. Try registering it in a service and see if that works

0

精彩评论

暂无评论...
验证码 换一张
取 消