任何人都可以告诉我如何在pass data through bundle or any thing
之间的two installed application
之间安卓吗?
我已经用Google搜索了但无法获得任何适当的指南
我尝试Content Provider正如一些类似的此类查询Data sharing between two applications所建议的那样,但我对内容提供商非常陌生,我试图从官方文档中获取一些信息,但无法成功< / p>
非常感谢
答案 0 :(得分:3)
Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(ComponentName.unflattenFromString("another app package name"));
intent.addCategory("android.intent.category.LAUNCHER");
Bundle bundle = new Bundle();
bundle.putInt("key", 1);
intent.putExtras(bundle);
startActivity(intent);
答案 1 :(得分:2)
对于共享数据,android提供了Intent类。
答案 2 :(得分:2)
您可以简单地使用BroadcastReceiver
。如果您按照Android
标记操作,则会注意到建议使用本地BroadcastReceiver
和本地sendBroadcasts()
的频率。在您的情况下,您需要全局 BroadcastReceiver
,以便您可以在应用间级别进行通信。我建议使用自定义Actions
进行广播,因为如果你不能很好地处理它们,Android系统可能会导致错误。
广播使用Intent
进行通信。
答案 3 :(得分:1)
如果你的意思是两个独立的应用程序 您可以从一个应用程序将数据写入文件,并从其他应用程序中读取该文件