Android 如何停止搜索gps挂起的意图

Android 如何停止搜索gps挂起的意图,android,android-intent,gps,android-pendingintent,Android,Android Intent,Gps,Android Pendingintent,我正在使用location manager类搜索当前位置 mLocationManager = (LocationManager) context .getSystemService(Context.LOCATION_SERVICE); i = new Intent(context, LocationService.class); pi = PendingIntent.getService(context, 9, i, Pendin

我正在使用location manager类搜索当前位置

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。我也尝试过取消未决的意图,但它不起作用