Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Geolocation 使用Parse.com发送地理推送通知_Geolocation_Parse Platform_Push Notification_Push - Fatal编程技术网

Geolocation 使用Parse.com发送地理推送通知

Geolocation 使用Parse.com发送地理推送通知,geolocation,parse-platform,push-notification,push,Geolocation,Parse Platform,Push Notification,Push,我正在尝试使用Parse.com JavaScript API实现地理推送通知 我需要在距某个地质点1公里的近球体内发送推送通知。我的代码如下: Parse.initialize("<MyApplicationId>", "<MyParseRestAPIKey>"); var ponto = new Parse.GeoPoint(latitude, longitude); // Find users near a giv

我正在尝试使用Parse.com JavaScript API实现地理推送通知

我需要在距某个地质点1公里的近球体内发送推送通知。我的代码如下:

Parse.initialize("<MyApplicationId>", "<MyParseRestAPIKey>");

            var ponto = new Parse.GeoPoint(latitude, longitude);

            // Find users near a given location
            var userQuery = new Parse.Query(Parse.User);
            userQuery.withinMiles("location", ponto, 1.0);

            // Find devices associated with these users
            var pushQuery = new Parse.Query(Parse.Installation);
            pushQuery.matchesQuery('owner', userQuery);

            Parse.Push.send({
              where: pushQuery,
              data: {
                title: "Geolocalização Urba me",
                alert: "A partir de agora você vai receber muitas promoções"
              }
            }, {
              success: function() {
                alert("Notificação enviada com sucesso!");
              },
              error: function(error) {
                alert("Notificação não enviada!");
              }
            });
我总是得到成功的信息,但它不起作用。在Parse仪表板中创建了campaing,但没有发送推送

我做错了什么


致以最诚挚的问候,

我不知道javascript,但首先我将检查第一个查询填充获取的内容。第一个可能不返回任何用户。因此,在这一行之后:

userQuery.withinMiles("location", ponto, 1.0);
插入以下内容:

query.find({
  success: function(results) {
    alert("Successfully retrieved " + results.length + " users.");
  },
  error: function(error) {
    alert("Error: " + error.code + " " + error.message);
  }
});
这一个应该返回至少1个用户,推送通知才能工作。再说一遍,我不太懂javascript语言,我只是想帮你