【问题标题】:How I can send a user to a website, from a push notification in Android?如何通过 Android 中的推送通知将用户发送到网站?
【发布时间】:2013-12-06 02:10:49
【问题描述】:

我最近安装了适用于 Android 推送通知的 SDK。我开始工作。但我想要的是当用户点击它时,带你到一个 URL。现在我已经把它放在那里了。但是当我打开APP时直接进入浏览器。任何人都可以帮忙吗?谢谢。

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Parse.initialize(this, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy");
PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.xxxxxxxxxxx.com"));
startActivity(browserIntent);}

【问题讨论】:

    标签: android url push-notification browser


    【解决方案1】:

    您必须从 onCreate 方法中删除 startActivity(browserIntent)。 onCreate 方法在活动启动时执行,而不是在用户单击通知时执行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多