【发布时间】:2015-11-23 10:18:48
【问题描述】:
有两个应用程序,App1 和 App2。我在 App1 中启动了这样的服务:
Intent sendIntent = new Intent(this, HelloService.class);
sendIntent.setAction("getDataFromApp1");
sendIntent.putExtra("dataKey", "This is data I am sending.");
startService(sendIntent);
现在我想从该服务中获取数据[我使用putExtra() 在 Intent 中设置的 String 对象] 并将其显示在 App2 中。
所以我的问题是如何访问由另一个应用程序创建的服务中的数据。我已经在 Manifest File 中使用 android:exported=true 声明了该服务。
【问题讨论】:
-
然后使用“绑定服务”模式
-
我是android新手,不知道绑定服务
-
所以了解它,更多here