打开后,在OneSignal推送通知中禁用启动URL

时间:2019-07-19 06:53:18

标签: ionic-framework ionic4 onesignal

打开后无法在OneSignal推送通知中禁用启动URL。尝试将kOSSettingsKeyInAppLaunchURL从true切换为false,但仍然可以打开Safari。

我该怎么做才能完全删除启动网址?预先感谢。

我在OneSignal app.component.ts中的代码如下,

if (this.appConfig.Onesignal_Enable == true) {
        this.oneSignal.startInit(this.appConfig.OneSignal_AppID, this.appConfig.GCM_SenderID);
        this.oneSignal.iOSSettings({
          kOSSettingsKeyInAppLaunchURL: false,
          kOSSettingsKeyAutoPrompt: true,
        });

        this.oneSignal.handleNotificationOpened().subscribe(() => {
          // do something when a notification is opened
          this.navCtrl.navigateForward('positions');
        });
        this.oneSignal.endInit();
      }

2 个答案:

答案 0 :(得分:0)

使用PHP解决了它在网络上的问题。对于在WordPress上运行的任何人,这都是一个很好的过滤器。

add_filter( 'onesignal_send_notification', 'onesignal_send_notification_filter', 10, 4 );
function onesignal_send_notification_filter($fields, $new_status, $old_status, $post) {
    // Set player ids as subscribed to onesignal notification (see users in onesignal dashboard)
    $fields['isAndroid'] = true;
    $fields['isIos'] = true;
    $fields['isAnyWeb'] = false;
    $fields['isChrome'] = false;
    $fields['data'] = array(
        "myappurl" => $fields['url']
    );
    /* Unset the URL to prevent opening the browser when the notification is clicked */
    unset($fields['url']);
    return $fields;
}

答案 1 :(得分:0)

您可以将 launchURL 的架构更改为不是 httphttps