Example usage for android.app Activity unregisterReceiver

List of usage examples for android.app Activity unregisterReceiver

Introduction

In this page you can find the example usage for android.app Activity unregisterReceiver.

Prototype

@Override
    public void unregisterReceiver(BroadcastReceiver receiver) 

Source Link

Usage

From source file:Main.java

public static void unRegisteReceiver(Activity activity, BroadcastReceiver receiver) {
    activity.unregisterReceiver(receiver);
}

From source file:Main.java

/**
 * unregister bluetooth receiver/*  w w  w  . j  a  v a2 s  .  c om*/
 *
 * @param receiver bluetooth broadcast receiver
 * @param activity activity
 */
public static void unregisterBluetoothReceiver(BroadcastReceiver receiver, Activity activity) {
    if (null == receiver || null == activity) {
        return;
    }
    activity.unregisterReceiver(receiver);
}

From source file:com.dwdesign.tweetings.fragment.BaseDialogFragment.java

public void unregisterReceiver(final BroadcastReceiver receiver) {
    final Activity activity = getActivity();
    if (activity == null)
        return;//ww  w.  j a v  a 2  s  .  c o m
    activity.unregisterReceiver(receiver);
}

From source file:com.rjfun.cordova.sms.SMSPlugin.java

private PluginResult stopWatch(CallbackContext callbackContext) {
    Log.d(LOGTAG, ACTION_STOP_WATCH);//from www  . jav a  2s. c  om
    Activity ctx = this.cordova.getActivity();
    if (this.mReceiver != null) {
        ctx.unregisterReceiver(this.mReceiver);
        this.mReceiver = null;
        Log.d(LOGTAG, "broadcast receiver unregistered");
    }
    if (this.mObserver != null) {
        ctx.getContentResolver().unregisterContentObserver(this.mObserver);
        this.mObserver = null;
        Log.d(LOGTAG, "sms inbox observer unregistered");
    }
    if (callbackContext != null) {
        callbackContext.success();
    }
    return null;
}