应用程序插件与不同应用程序的服务之间的通信 [Android]
Communication between an app-plugin to a service of a different app [Android]
我是这方面的新手,您能帮我指出正确的方向吗?
我有 2 个应用程序
1) 有服务的应用程序 - APP1
2) 有插件的应用程序 - APP2
场景:
APP2 想访问 APP1 的服务器,以便它可以从其源应用程序发送数据。然后 APP2 必须访问 APP1 的服务才能这样做。
过程:
APP2 启动 -> APP2 插件 -> 发送数据 -> APP1 服务 -> APP1 服务器
APP1 服务器 -> APP1 服务 -> 发送数据 -> APP2 插件 -> 根据结果对 APP2 执行操作
提前致谢!这个我真的是一头雾水
可以使用以下方法
- 内容提供商:
A content provider manages access to a central repository of data. A
provider is part of an Android application, which often provides its
own UI for working with the data. However, content providers are
primarily intended to be used by other applications, which access the
provider using a provider client object. Together, providers and
provider clients offer a consistent, standard interface to data that
also handles inter-process communication and secure data access.
您可以使用权限、readPermission、writePermission 来确保安全。
<provider
android:permission="string"
android:readPermission="string"
android:writePermission="string" >
. . .
</provider>
更多信息:provider-element
2.broadcast:
Android apps can send or receive broadcast messages from the Android
system and other Android apps, similar to the publish-subscribe design
pattern. These broadcasts are sent when an event of interest occurs.
For example, the Android system sends broadcasts when various system
events occur, such as when the system boots up or the device starts
charging. Apps can also send custom broadcasts, for example, to notify
other apps of something that they might be interested in (for example,
some new data has been downloaded).
更多信息Broadcasts
我是这方面的新手,您能帮我指出正确的方向吗?
我有 2 个应用程序
1) 有服务的应用程序 - APP1
2) 有插件的应用程序 - APP2
场景:
APP2 想访问 APP1 的服务器,以便它可以从其源应用程序发送数据。然后 APP2 必须访问 APP1 的服务才能这样做。
过程:
APP2 启动 -> APP2 插件 -> 发送数据 -> APP1 服务 -> APP1 服务器
APP1 服务器 -> APP1 服务 -> 发送数据 -> APP2 插件 -> 根据结果对 APP2 执行操作
提前致谢!这个我真的是一头雾水
可以使用以下方法
- 内容提供商:
A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily intended to be used by other applications, which access the provider using a provider client object. Together, providers and provider clients offer a consistent, standard interface to data that also handles inter-process communication and secure data access.
您可以使用权限、readPermission、writePermission 来确保安全。
<provider
android:permission="string"
android:readPermission="string"
android:writePermission="string" >
. . .
</provider>
更多信息:provider-element
2.broadcast:
Android apps can send or receive broadcast messages from the Android system and other Android apps, similar to the publish-subscribe design pattern. These broadcasts are sent when an event of interest occurs. For example, the Android system sends broadcasts when various system events occur, such as when the system boots up or the device starts charging. Apps can also send custom broadcasts, for example, to notify other apps of something that they might be interested in (for example, some new data has been downloaded).
更多信息Broadcasts