Code example for Context

Methods: unregisterReceiver

0
 
    /** 
     * Closes all resources related to the MtpClient object 
     */ 
    public void close() { 
        mContext.unregisterReceiver(mUsbReceiver);
    } 
 
    /** 
     * Registers a {@link android.mtp.MtpClient.Listener} interface to receive 
     * notifications when MTP or PTP devices are added or removed. 
     * 
     * @param listener the listener to register 
     */ 
    public void addListener(Listener listener) {
        synchronized (mDevices) {
            if (!mListeners.contains(listener)) {
                mListeners.add(listener);
            } 
        } 
    }