android 使用SecurityException检查CarConnection应用程序崩溃- RECEIVER_EXPORTED或RECEIVER_NOT_EXPORTED

r1zhe5dt  于 2023-11-15  发布在  Android
关注(0)|答案(1)|浏览(1404)

在Android 34中,应用程序崩溃与SecurityException: com.mgg.timmi: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
在Android 34中调用时发生此崩溃

new CarConnection(this).getType().observe(this, new Observer<Integer>() {
        @Override
        public void onChanged(Integer integer) {
            Log.d(TAG, "CarConnection status changed");
        }
    });

字符串
Observer和Oberserverable已弃用,那么我还可以使用什么来检查设备是否与Android Car连接。
我使用car.app:1.2.0实现。
谢谢GGK

gt0wga4j

gt0wga4j1#

对于在API 34或更高版本的设备上运行的面向API 34或更高版本的应用,您需要使用1.3.0-beta01或更高版本,如https://developer.android.com/training/cars/apps#car-connection所述。

相关问题