Code example for Context

Methods: registerReceiver

0
     * 
     * @return A new receiver that records and can be queried on how many downloads have completed. 
     */ 
    protected MultipleDownloadsCompletedReceiver registerNewMultipleDownloadsReceiver() { 
        MultipleDownloadsCompletedReceiver receiver = new MultipleDownloadsCompletedReceiver();
        mContext.registerReceiver(receiver, new IntentFilter(
                DownloadManager.ACTION_DOWNLOAD_COMPLETE));
        return receiver;
    } 
 
    /** 
     * Enables or disables WiFi. 
     * 
     * Note: Needs the following permissions: 
     *  android.permission.ACCESS_WIFI_STATE 
     *  android.permission.CHANGE_WIFI_STATE 
     * @param enable true if it should be enabled, false if it should be disabled 
     */ 
    protected void setWiFiStateOn(boolean enable) throws Exception {
        Log.i(LOG_TAG, "Setting WiFi State to: " + enable);
        WifiManager manager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE);