I have used Parse for sending and receiving the Push notifications. I have minutely followed the tutorial and implemented it successfully. Now I am required to send the notification to user within certain miles selected by users.
For Eg : If the user select 100, then the notification should be sent to all the users who have installed my app and are within 100 miles from the user's (User who is broadcasting the notification) current location.
I found a code snippet on Parse's website regarding the same but i am not receiving any notification if i use the second query which is commented in the following code
The method didReceiveRemoteNotification is not called if i use the second query
.Only if i use the first query i am successfully receiving the notification.
I am fresher into Push notifications and Parse. Let me know if i am missing something silly so that i can fix it up.I have been revolving around this issue for a very long time so guys please help.
PFGeoPoint *myLoc = [PFGeoPoint geoPointWithLatitude:myLatitude longitude:myLongitude];
PFQuery *userQuery = [PFUser query];
[userQuery whereKey:@"location"
nearGeoPoint:myLoc
withinMiles:100];
PFQuery *myQuery = [PFInstallation query];
[myQuery whereKey:@"deviceType" equalTo:@"ios"];
//[myQuery whereKey:@"user" matchesQuery:userQuery];
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
txt.text, @"alert",
@"1", @"badge",
@"sound.caf", @"sound",
nil];
PFPush *push = [[PFPush alloc] init];
[push setQuery:myQuery];
[push setData:data];
[push sendPushInBackground];