Android addProximityAlert仅在最后一个位置激发
我正在使用下一个函数设置proximityAlerts:Android addProximityAlert仅在最后一个位置激发,android,geolocation,android-intent,Android,Geolocation,Android Intent,我正在使用下一个函数设置proximityAlerts: public void addProximityAlerts(double latitude, double longitude, double radius) { try{ //Prepare proximity Intent proximityIntent = new Intent(activityContext.getString(R.string.inten
public void addProximityAlerts(double latitude, double longitude, double radius)
{
try{
//Prepare proximity Intent
proximityIntent = new Intent(activityContext.getString(R.string.intent_message_location_fetched));
proximityPendingIntent = PendingIntent.getBroadcast(activityContext, 0, proximityIntent, PendingIntent.FLAG_CANCEL_CURRENT);
locationManager.addProximityAlert(latitude, longitude, (float) radius, -1, proximityPendingIntent);
}
catch (Exception e) {
Log.d("ERROR", e.toString());
SendHandle(LOCATION_ADDING_ALERTS_FAILED);
}
}
并称之为:
location.addProximityAlerts(33.3333, 33.3333, 1000);
location.addProximityAlerts(12, 12, 5000);
location.addProximityAlerts(42, 42, 5000);
但只有在我42岁左右时,意图才会开火,42岁是我最后一次使用的位置。
发生了什么?警报不应该适用于所有给定的点吗?操作必须是唯一的!
谢谢
现在,我在addProximityAlerts finction中使用
getString(R.string.intent_message_location_fetched)+latitude+longitude
作为独特的行动