如何停止搜索gps待定意图

时间:2015-05-30 10:50:25

标签: android android-intent gps android-pendingintent

我正在使用位置管理器类来搜索当前位置。

mLocationManager = (LocationManager) context
                .getSystemService(Context.LOCATION_SERVICE);
i = new Intent(context, LocationService.class);
pi = PendingIntent.getService(context, 9, i,
                PendingIntent.FLAG_CANCEL_CURRENT);
mLocationManager.requestSingleUpdate(LocationManager.NETWORK_PROVIDER,
                pi);
mLocationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, pi);

当用户在室内时,我的应用会继续搜索GPS无限时间。我也尝试取消未决的意图,但它无法正常工作。

0 个答案:

没有答案