我有一个在android上运行的ionic 2应用程序,还有一个wordpress站点提供数据。我有使用onesignal的通知。问题是通知在rest API数据更新之前到达。应用程序可能需要长达一分钟的时间才能更新。有没有办法延迟onesignal通知?或者提高wordpress json数据的速度?
发布于 2017-01-27 00:22:03
您可能无法将wp json数据的速度提高那么多,有一些改进的空间(以毫秒为单位),但没有太大的提高。只是需要时间。
如果你有编程知识,我建议你这样做:
我知道这帮不了什么忙,但是... :)
发布于 2018-03-23 03:34:07
你的方法几乎完成了。我也在找同样的东西。我拿了你的代码,做了一点修改。它对我来说工作得很好。
//Send OneSignal Push after some time delay.
add_filter('onesignal_send_notification', 'onesignal_send_notification_filter', 10, 4);
function onesignal_send_notification_filter($fields, $new_status, $old_status, $post) {
//delay.
$delay = '+25 minutes';
//replace it with your timezone.
$timezone = 0530;
$current_time = current_time('M d Y H:i:s e+$timezone');
$future_time = date( 'M d Y H:i:s e+$timezone', strtotime( $delay, strtotime( $current_time ) ) );
// Schedule the notification to be sent in the future
$fields['send_after'] = $future_time;
return $fields;
}https://stackoverflow.com/questions/41878013
复制相似问题