鹤岗网站seo淘宝 客要推广网站怎么做
2026/1/10 0:58:38 网站建设 项目流程
鹤岗网站seo,淘宝 客要推广网站怎么做,企业网盘搭建,2017国办网站建设规范背景#xff1a; Binder AIDL#xff0c;Socket可以解决APP之间的通信。 APP之间的数据安全共享该如何实现呢#xff1f; 方案: 利用ContentProvider和contentResolver可实现在不同应用程序之间的数据共享#xff0c;并保证被访问数据的安全性。ContentProvider用于暴露…背景Binder AIDLSocket可以解决APP之间的通信。APP之间的数据安全共享该如何实现呢方案:利用ContentProvider和contentResolver可实现在不同应用程序之间的数据共享并保证被访问数据的安全性。ContentProvider用于暴露数据contentResolver用于操作数据。案例Google 地图-车辆界面使用地图-车辆接口 (MVI)协议缓冲区API 实现 Google 地图与车辆制造商的车辆系统之间的双向通信。通常该接口由 OEM 厂商通过运行在 Android Automotive 平台上的应用程序来实现。Google sample介绍原文Maps-Vehicle Interface ArchitectureThe Maps-Vehicle Interface (MVI) uses the Android:content provider to share data between processesContentProvider on the vehicle sideContentObserver on the Google Maps sideThe MVI exchanges data in three steps:The vehicle notifies Google Maps, through Android ContentResolver, that either new content is available or existing content has changed.Google Maps queries the vehicles ContentProvider, through Android ContentResolver, with a specific content Uri.Once a data pipe has been established, wire-encoded protocol buffers can be exchanged by Google Maps either by reading or writing to the OEM app ContentProvider.实现细节创建内容提供程序Google Maps 订阅了一个 Android ContentProvider类OEM 应用必须实现该类才能与 Google Maps 交换数据。OEM 应用只需实现其ContentProvider类的ContentProvider.openFile方法该方法返回一个ParcelFileDescriptor 用于建立一个读/写数据管道以便交换通过ParcelFileDescriptor.createPipe获取的线编码协议缓冲区。对于任何特定的内容URI ContentProvider实现必须严格支持两种访问模式一种是只读访问模式“r”用于从车辆读取数据到地图另一种是只写访问模式“w”用于从地图向车辆写入数据。注意OEM 应用可以将线路编码的协议缓冲区存储在SharedPreferences中该缓冲区在应用重启后仍然保留。您可以在oem/VehicleContentProvider.java中查看ContentProvider示例实现以及将序列化的协议缓冲区存储在SharedPreferences中。允许 Google Maps 访问 ContentProvider 类要使 Google Maps 能够访问ContentProvider类必须在 Android Manifest 文件中通过provider标签将其公开。最重要的是必须将exported属性设置为true以允许外部应用查询ContentProvider类并且权限必须为google_maps_energy用于电动汽车能源模型功能或google_maps_settings用于 Google Maps 自定义功能。例如provider android:name.VehicleContentProvider android:authoritiesgoogle_maps_settings android:exportedtrue/处理多个内容授权授权实体之间用分号(;)隔开在单个ContentProvider实现中处理多个内容授权机构是可行的但并非必须。为此ContentProvider必须在AndroidManifest.xml的provider标签中列出所有要处理的授权机构用分号分隔。以下示例允许VehicleContentProvider类同时处理google_maps_settings和google_maps_energy内容授权provider android:name.VehicleContentProvider android:authoritiesgoogle_maps_settings;google_maps_energy android:exportedtrue/

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询