接近警报 - 开始活动

时间:2012-08-06 02:52:22

标签: android locationmanager android-pendingintent

我正在使用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);

    }

0 个答案:

没有答案