List of usage examples for android.content Context unregisterReceiver
public abstract void unregisterReceiver(BroadcastReceiver receiver);
From source file:Main.java
/** * Unregister overall broadcast receiver * * @param receiver Broadcast receiver//from w w w . j a v a 2s . c o m */ public static void unregisterOverall(Context context, BroadcastReceiver receiver) { context.unregisterReceiver(receiver); }
From source file:Main.java
public static void tryUnregisterReceiver(Context context, BroadcastReceiver broadcastReceiver) { try {//from www.jav a 2 s . c o m context.unregisterReceiver(broadcastReceiver); } catch (IllegalArgumentException e) { // TODO: Figure out why this exception is being thrown for receivers that _are_ registered } }
From source file:Main.java
public static void unregisterBroadCast(Context context, BroadcastReceiver receiver) { if (receiver != null) { context.unregisterReceiver(receiver); }/*from w ww . ja v a2s. co m*/ }
From source file:com.woodblockwithoutco.quickcontroldock.util.ReceiverUtil.java
public static void unregisterReceiverSafe(Context context, BroadcastReceiver receiver) { try {/* w w w . j a v a 2 s . c o m*/ context.unregisterReceiver(receiver); } catch (IllegalArgumentException e) { Log.e(TAG, "Caught attempt to unregister inactive BroadcastReceiver [" + receiver.getClass().getName() + "]"); } }
From source file:Main.java
/** * Unregisters the given receiver from the given context. * @param context the context from which to unregister * @param receiver the receiver to unregister * @return true if it was successfully unregistered, or false if the receiver was not registered *///from ww w .ja va2 s.c o m public static boolean safeUnregisterBroadcastReceiver(Context context, BroadcastReceiver receiver) { try { context.unregisterReceiver(receiver); return true; } catch (IllegalArgumentException ex) { return false; } }
From source file:Main.java
public static void unRegister(Context context, BroadcastReceiver broadcastReceiver) { if (broadcastReceiver == null || context == null) { return;/* w w w . j a v a 2 s. c o m*/ } context.unregisterReceiver(broadcastReceiver); }
From source file:ca.rmen.android.networkmonitor.app.service.NetMonNotification.java
static void dismissNotifications(Context context) { Log.v(TAG, "dismissNotification"); context.unregisterReceiver(sDisableBroadcastReceiver); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(NOTIFICATION_ID_ONGOING); notificationManager.cancel(NOTIFICATION_ID_FAILED_EMAIL); notificationManager.cancel(NOTIFICATION_ID_FAILED_TEST); }
From source file:com.mutu.gpstracker.streaming.CustomUpload.java
public static synchronized void shutdownStreaming(Context ctx) { if (sCustomUpload != null) { ctx.unregisterReceiver(sCustomUpload); sCustomUpload.onShutdown();/* w w w. j a v a2 s . c o m*/ sCustomUpload = null; } }
From source file:nl.sogeti.android.gpstracker.streaming.CustomUpload.java
public static synchronized void shutdownStreaming(Context ctx) { Log.d(CustomUpload.class, "shutdownStreaming(Context)"); if (sCustomUpload != null) { ctx.unregisterReceiver(sCustomUpload); sCustomUpload.onShutdown();/*from w ww. j av a 2 s . c om*/ sCustomUpload = null; } }
From source file:org.wahtod.wififixer.utility.BroadcastHelper.java
public static void unregisterReceiver(Context c, BroadcastReceiver receiver) { String hashString = receiver.toString(); if (isRegistered(receiver)) { try {/*from w w w . jav a2 s . c om*/ if (getMap().get(hashString)) LocalBroadcastManager.getInstance(c).unregisterReceiver(receiver); else c.unregisterReceiver(receiver); } catch (Exception e) { e.printStackTrace(); } getMap().remove(hashString); } }