【问题标题】:Pushwoosh: Set Badge with PHP APIPushwoosh:使用 PHP API 设置徽章
【发布时间】:2016-02-10 09:22:22
【问题描述】:

我正在使用付费的 Pushwoosh 帐户,以便以编程方式向我的用户发送推送通知。

我已经实现了Pushwoosh PHP SDK,一切正常,但我无法在 iOS 设备上设置通知徽章,如下图所示:

到目前为止我的代码是:

$devicesArr[] = ...

$pushwoosh = Pushwoosh::create()
                        ->setApplication('79XXX-9CXXX')
                        ->setAuth('Wkf...2C8');

//Create the Message
$request = CreateMessageRequest::create()
                        ->addNotification(Notification::create()
                        ->setContent('A new workout is available!')
                        ->setDevices($devicesArr));

//Call the REST Web Service
$response = $pushwoosh->createMessage($request);

我尝试根据this page使用->setBadge(5)方法,但这也不起作用:

$request = SetBadgeRequest::create()
    ->setBadge(1)
    ->setHwid('18D...1AF');

你知道我怎样才能实现我的目标吗?

【问题讨论】:

  • 您的应用收到通知了吗?注册通知的时候,有没有设置UIRemoteNotificationTypeBadgeUIUserNotificationSettings
  • 感谢您的回复。我正在使用 Ionic/Cordova 和 Pushwoosh-Cordova-Plugin 来使用 Pushwoosh。是的,一切正常,因为我正在检索推送通知(在 iOS 和 Android 上)。但我无法设置徽章计数。

标签: php ios push-notification apple-push-notifications pushwoosh


【解决方案1】:

我无法在 Cordova Sample (https://github.com/Pushwoosh/pushwoosh-phonegap-cordova-sample/tree/master/Phonegap-iOS-Android-WP) 上重现此内容,您能分享一个简单的示例吗?

当您收到带有徽章的推送时,您确定应用已关闭吗?

【讨论】:

  • 你好。 “您无法在 Cordova Sample 上重现此内容”是什么意思?我认为问题在于我在上面发布的 PHP sn-p。 Pushwoosh/Cordova 实现本身运行良好。我可以使用 Pushwoosh.com 仪表板设置通知徽章,但不能使用 PHP API(上面的 sn-p)。
【解决方案2】:

根据文档,这不是您在设备上设置徽章编号的方法。

重要

此方法不用于更新设备上的徽章值。 请改为使用带有“ios_badges”参数的 /createMessage 请求。 http://docs.pushwoosh.com/docs/setbadge

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-03
    • 1970-01-01
    • 1970-01-01
    • 2015-06-25
    相关资源
    最近更新 更多