Add ConnectivityManager.unregisterNetworkCallback(PendingIntent) API
This better pairs up with registerNetworkCallback(NetworkRequest, PendingIntent). Bug:22175708 Change-Id: I336df3f48a0b814f1cbeba6d00afc4e6cc536483
This commit is contained in:
@@ -2565,7 +2565,7 @@ public class ConnectivityManager {
|
|||||||
* replaced by this one, effectively releasing the previous {@link NetworkRequest}.
|
* replaced by this one, effectively releasing the previous {@link NetworkRequest}.
|
||||||
* <p>
|
* <p>
|
||||||
* The request may be released normally by calling
|
* The request may be released normally by calling
|
||||||
* {@link #releaseNetworkRequest(android.app.PendingIntent)}.
|
* {@link #unregisterNetworkCallback(android.app.PendingIntent)}.
|
||||||
* <p>This method requires the caller to hold the permission
|
* <p>This method requires the caller to hold the permission
|
||||||
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
|
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
|
||||||
* @param request {@link NetworkRequest} describing this request.
|
* @param request {@link NetworkRequest} describing this request.
|
||||||
@@ -2618,6 +2618,19 @@ public class ConnectivityManager {
|
|||||||
} catch (RemoteException e) {}
|
} catch (RemoteException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a callback previously registered via
|
||||||
|
* {@link #registerNetworkCallback(NetworkRequest, android.app.PendingIntent)}.
|
||||||
|
*
|
||||||
|
* @param operation A PendingIntent equal (as defined by {@link Intent#filterEquals}) to the
|
||||||
|
* PendingIntent passed to
|
||||||
|
* {@link #registerNetworkCallback(NetworkRequest, android.app.PendingIntent)}.
|
||||||
|
* Cannot be null.
|
||||||
|
*/
|
||||||
|
public void unregisterNetworkCallback(PendingIntent operation) {
|
||||||
|
releaseNetworkRequest(operation);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the system whether it should switch to {@code network} regardless of whether it is
|
* Informs the system whether it should switch to {@code network} regardless of whether it is
|
||||||
* validated or not. If {@code accept} is true, and the network was explicitly selected by the
|
* validated or not. If {@code accept} is true, and the network was explicitly selected by the
|
||||||
|
|||||||
Reference in New Issue
Block a user