3

我正在使用 Proximity Alert 开始一项活动。

我在我的支持 GPS 的 Android 2.3 模拟器上运行了这个,但是在重新启动 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);

    }
4

0 回答 0