我正在使用next函数来设置proximityAlerts:
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岁时 - 才会解雇,这是最后一次使用的位置。 怎么了?不应该提醒所有给定点的警报吗?
答案 0 :(得分:1)
行动必须是独一无二的! 感谢this
现在我正在使用
在addProximityAlerts finction中创建接收器getString(R.string.intent_message_location_fetched)+latitude+longitude
作为独特的行动