资 源 简 介
Android Proximity Alert 手机接近进警告或提示功能一例
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
//定义接近区域的大致经度、纬度
double longitude = 113.39;
double latitude = 23.13;
//定义接近区域的半径(5公里)
float radius = 5000;
//定义接近区域后 触发的PendingIntent
Intent intent = new Intent(this,ProximityAlertReciever.class);
PendingIntent pi = PendingIntent.getBroadcast(this, -1, intent, 0);
//添加接近警告
lm.addProximityAlert(latitude, longitude, radius, -1, pi);