我想通過使用Parse.I通過推送通知開始谷歌播放我通過使用Parse儀表板的JSON發送URL並獲取它。我用廣播接收機嘗試了很多,但無處可去。那麼一點點的幫助或提示將是明顯的使用Parse.com通過推送通知打開Play商店應用android
代碼
IntentFilter intentFilter = new IntentFilter("MyAction");
pushReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras();
String message = extras != null ? extras.getString("com.parse.Data") : "";
try {
JSONObject jsonObject = new JSONObject(message);
String url = jsonObject.getString("url");
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + url));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + url)));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
};
registerReceiver(pushReceiver, intentFilter);
「我試了很多與廣播接收機」 - 你有什麼試過?發佈您的代碼,預期結果以及實際發生的事情。 –
就像用戶沒有更新他的應用一樣,它就像app store store更新一樣。我想檢查一下,如果我自己也可以使用解析來做到這一點? @CommonsWare – MGDroid
@Tanis.7x實際上是我用調試器試過的代碼工作正常。問題是,當我在沒有調試的情況下嘗試它時,它只是打開我在應用程序中設置的頁面。代碼從onstart()調用。 – MGDroid