com.android.camera.NEW_PICTURE 所有应用程序 Android N 均已弃用?



我使用com.android.camera.NEW_PICTURE和android.hardware.action.NEW_PICTURE来检查图像是否在我的应用程序中捕获。

但它收到警告com.android.camera.NEW_PICTURE从Android N版本开始的所有应用程序都已弃用到目标SDK。

我该如何解决?任何人都可以为安卓 N 帮助我吗?

我的代码是

**<receiver android:name=".receiver.CameraReceiver"
android:enabled="true">
<intent-filter android:priority="10000">
<action android:name="android.intent.action.CAMERA_BUTTON" />
<action android:name="com.android.camera.NEW_PICTURE" />
<action android:name="android.hardware.action.NEW_PICTURE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</receiver>**

谢谢。

文档指出它在 Android N 中已弃用。

在Android N中,此广播已被删除,建议应用程序改用JobInfo.Builder.addTriggerContentUri(JobInfo.TriggerContentUri(。

在Android O中,此广播已被恢复,但仅适用于注册的接收器。如果正在主动运行的应用想要立即获得有关正在拍摄的照片的明确信号,则可以再次收听广播,但是因此而进行繁重工作(或需要启动(的任何内容仍应使用 JobScheduler。

相关内容

最新更新