应用程序由谷歌播放开放

时间:2014-03-05 08:01:30

标签: android facebook google-play

当用户首次打开应用时,谷歌市场是否有意图发送?

我想抓住用户点击Facebook请求的事件,然后进入Google Play市场安装我的应用

用户点击Facebook请求去我已经拥有的谷歌游戏市场的部分。

但是我想在用户第一次打开应用程序时处理此请求。

我怎么知道这种情况已经发生了?

1 个答案:

答案 0 :(得分:0)

当应用程序第一次打开时,Google Play不会发送任何意图。当应用程序安装在手机上时,Google Play会发送一个意图,该意图可以由设备上安装的其他应用程序接收。即使安装的应用程序也没有收到此意图。

正如Merlevede建议的那样,处理此问题的最佳方法是在第一次启动应用时设置共享首选项。

可以通过以下方式完成:

SharedPreferences appPreferences;
boolean isAppLaunched = false;
appPreferences = PreferenceManager.getDefaultSharedPreferences(this);
isAppLaunched = appPreferences.getBoolean("isAppLaunched", false);

if(!isAppLaunched) {

//Do your stuff


SharedPreferences.Editor editor = appPreferences.edit();
editor.putBoolean("isAppLaunched", true);
editor.commit();
}
相关问题