我正在使用Proximity Alert来启动活动。
我在我的Android 2.3仿真器上使用GPS支持,但在重新启动PC后它不再有效。不确定是不是因为有臭虫的Eclipse。
我必须在代码中遗漏某些东西或者破坏它并且现在看不到它:
private LocationManager locationManager;
private PendingIntent pendingIntent;
double lat = 33.426517;
double lon = -70.439244;
float radius = 1000f;
long expiration = -1;
@Override
public void onCreate(Bundle savedInstanceState) {
/* Instantiate MapView, ZoomControls, layout, etc. here
*/
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.addProximityAlert(lat, lon, radius, expiration,
pendingIntent);
Intent newActivity = new Intent(this, InfoActivity.class);
pendingIntent = PendingIntent.getActivity(this, 0, newActivity, 0);
}