为什么我会收到消息 "All included players are not subscribed"?
Why am I receiving the message "All included players are not subscribed"?
我正在尝试使用 OneSignal 设置基于位置的推送通知,但我没有收到通知。我收到错误 All included players are not subscribed
。我不明白问题出在哪里,有什么想法吗?
在 "All Users" 的 OneSignal 列表中,未收到通知的用户已将 "Location Point" 设置为预期的纬度和经度坐标,并且该用户已订阅。我收到了没有位置的通知,因此发送和接收通知的过程有效。
我已将此行添加到我的 AndroidManifest.xml 文件中:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
我的 .run
函数中也有这一行:
window.plugins.OneSignal.promptLocation();
我的 php 向 OneSignal 发送请求:
$content = $_GET['content'];
$lat = $_GET['lat'];
$long = $_GET['long'];
$radius = $_GET['radius'];
$response = sendMessage($content, $lat, $long, $radius);
function sendMessage($message, $lat, $long, $radius){
$content = array(
"en" => $message
);
$fields = array(
'app_id' => "aaaaaa-eeee-yyyyy-xxxx-zzzz",
'filters' => array(array("field" => "location", "radius" => $radius, "lat" => $lat, "long" => $long)),
//'filters' => array(array("field" => "location", "radius" => "1000", "lat" => "55.819329", "long" => "-4.1696119")),
'included_segments' => array('All'),
'data' => array("foo" => "bar"),
'contents' => $content
);
$fields = json_encode($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8',
'Authorization: Basic FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
要求:
{content: "test", lat: "55.8653169", long: "-4.1696119", radius: "1000"}
回复:
{allresponses: "{"id":"","recipients":0,"errors":["All included players are not subscribed"]}"}
"All included players are not subscribed"
消息可能表示以下任何内容。
- 确保您已设置正确的
app_id
。
- 您没有订阅的用户。
- 您尚未在 OneSignal 控制面板的“应用程序设置”页面上为您的设备设置平台。
- 过滤器中没有用户。
您的位置可能在 1,000 多米外。尝试增加半径并确认您在 OneSignal 仪表板的“所有用户”页面上看到 "Location Point"。
我们有几个应用程序遇到了同样的问题,这很奇怪,因为第一个应用程序可以正常工作。结果是,我们急于看到一切正常,忘记将 OneSignal SDK 文件上传到网站的根目录。请确保将以下文件上传到您网站的根目录:
- OneSignalSDKUpdaterWorker.js
- manifest.json
- OneSignalSDKWorker.js
您可以从here下载SDK。
我正在尝试使用 OneSignal 设置基于位置的推送通知,但我没有收到通知。我收到错误 All included players are not subscribed
。我不明白问题出在哪里,有什么想法吗?
在 "All Users" 的 OneSignal 列表中,未收到通知的用户已将 "Location Point" 设置为预期的纬度和经度坐标,并且该用户已订阅。我收到了没有位置的通知,因此发送和接收通知的过程有效。
我已将此行添加到我的 AndroidManifest.xml 文件中:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
我的 .run
函数中也有这一行:
window.plugins.OneSignal.promptLocation();
我的 php 向 OneSignal 发送请求:
$content = $_GET['content'];
$lat = $_GET['lat'];
$long = $_GET['long'];
$radius = $_GET['radius'];
$response = sendMessage($content, $lat, $long, $radius);
function sendMessage($message, $lat, $long, $radius){
$content = array(
"en" => $message
);
$fields = array(
'app_id' => "aaaaaa-eeee-yyyyy-xxxx-zzzz",
'filters' => array(array("field" => "location", "radius" => $radius, "lat" => $lat, "long" => $long)),
//'filters' => array(array("field" => "location", "radius" => "1000", "lat" => "55.819329", "long" => "-4.1696119")),
'included_segments' => array('All'),
'data' => array("foo" => "bar"),
'contents' => $content
);
$fields = json_encode($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8',
'Authorization: Basic FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
要求:
{content: "test", lat: "55.8653169", long: "-4.1696119", radius: "1000"}
回复:
{allresponses: "{"id":"","recipients":0,"errors":["All included players are not subscribed"]}"}
"All included players are not subscribed"
消息可能表示以下任何内容。
- 确保您已设置正确的
app_id
。 - 您没有订阅的用户。
- 您尚未在 OneSignal 控制面板的“应用程序设置”页面上为您的设备设置平台。
- 过滤器中没有用户。
您的位置可能在 1,000 多米外。尝试增加半径并确认您在 OneSignal 仪表板的“所有用户”页面上看到 "Location Point"。
我们有几个应用程序遇到了同样的问题,这很奇怪,因为第一个应用程序可以正常工作。结果是,我们急于看到一切正常,忘记将 OneSignal SDK 文件上传到网站的根目录。请确保将以下文件上传到您网站的根目录:
- OneSignalSDKUpdaterWorker.js
- manifest.json
- OneSignalSDKWorker.js
您可以从here下载SDK。