Example usage for android.content IntentFilter IntentFilter

List of usage examples for android.content IntentFilter IntentFilter

Introduction

In this page you can find the example usage for android.content IntentFilter IntentFilter.

Prototype

public IntentFilter(Parcel source) 

Source Link

Usage

From source file:com.googlecode.android_scripting.facade.ui.NFCBeamTask.java

@SuppressLint("NewApi")
public void launchNFC() {
    Log.d(TAG, "launchNFC:" + beamStat);
    if (beamStat == 0) {
        _nfcAdapter.setNdefPushMessageCallback(this, getActivity());
        _nfcAdapter.setOnNdefPushCompleteCallback(this, getActivity());

        // start NFC Connection
        /*_nfcPendingIntent = PendingIntent.getActivity(getActivity().getApplicationContext(), 0,
              new Intent(getActivity().getApplicationContext(), FutureActivity.class)
             .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
                //from   www  .j  a v a  2  s . c o  m
        IntentFilter ndefDetected = new IntentFilter(
              NfcAdapter.ACTION_NDEF_DISCOVERED);
        try {
           ndefDetected.addDataType("application/com.hipipal.qpy.nfc");
        } catch (MalformedMimeTypeException e) {
           throw new RuntimeException("Could not add MIME type.", e);
        }
                
        _readTagFilters = new IntentFilter[] { ndefDetected };*/
    } else if (beamStat == 1) {
        //_nfcAdapter.setNdefPushMessageCallback(this, getActivity());
        //_nfcAdapter.setOnNdefPushCompleteCallback(this, getActivity());

        // start NFC Connection
        _nfcPendingIntent = PendingIntent.getActivity(getActivity().getApplicationContext(), 0,
                new Intent(getActivity().getApplicationContext(), FutureActivity.class)
                        .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP),
                0);

        IntentFilter ndefDetected = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
        try {
            ndefDetected.addDataType("application/com.hipipal.qpy.nfc");
        } catch (MalformedMimeTypeException e) {
            throw new RuntimeException("Could not add MIME type.", e);
        }

        _readTagFilters = new IntentFilter[] { ndefDetected };
    }
}

From source file:com.example.MobileSchoolDev.Utils.AutoUpdateApk.java

private void setupVariables(Context ctx) {
    context = ctx;//  ww  w . j  av  a  2 s .c  o  m

    packageName = context.getPackageName();
    preferences = context.getSharedPreferences(packageName + "_" + TAG, Context.MODE_PRIVATE);
    device_id = crc32(Secure.getString(context.getContentResolver(), Secure.ANDROID_ID));
    last_update = preferences.getLong("last_update", 0);
    NOTIFICATION_ID += crc32(packageName);
    //      schedule.add(new ScheduleEntry(0,24));

    ApplicationInfo appinfo = context.getApplicationInfo();
    if (appinfo.icon != 0) {
        appIcon = appinfo.icon;
    } else {
        Log_w(TAG, "unable to find application icon");
    }
    if (appinfo.labelRes != 0) {
        appName = context.getString(appinfo.labelRes);
    } else {
        Log_w(TAG, "unable to find application label");
    }
    if (new File(appinfo.sourceDir).lastModified() > preferences.getLong(MD5_TIME, 0)) {
        preferences.edit().putString(MD5_KEY, MD5Hex(appinfo.sourceDir)).commit();
        preferences.edit().putLong(MD5_TIME, System.currentTimeMillis()).commit();

        String update_file = preferences.getString(UPDATE_FILE, "");
        if (update_file.length() > 0) {
            if (new File(context.getFilesDir().getAbsolutePath() + "/" + update_file).delete()) {
                preferences.edit().remove(UPDATE_FILE).remove(SILENT_FAILED).commit();
            }
        }
    }
    raise_notification();

    if (haveInternetPermissions()) {
        context.registerReceiver(connectivity_receiver,
                new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    }
}

From source file:com.streaming.sweetplayer.PlayerActivity.java

@Override
public void onResume() {
    super.onResume();
    registerReceiver(broadcastReceiver, new IntentFilter(PlayerService.BROADCAST_ACTION));
    mBroadcastIsRegistered = true;/*  www.  ja va 2s.  c om*/
}

From source file:com.dafeng.upgradeapp.util.AutoUpdateApk.java

private void setupVariables(Context ctx) {
    context = ctx;/*from   ww w  .ja v  a  2 s.c  o m*/

    packageName = context.getPackageName();
    preferences = context.getSharedPreferences(packageName + "_" + TAG, Context.MODE_PRIVATE);
    device_id = crc32(Secure.getString(context.getContentResolver(), Secure.ANDROID_ID));
    last_update = preferences.getLong("last_update", 0);
    NOTIFICATION_ID += crc32(packageName);
    // schedule.add(new ScheduleEntry(0,24));

    ApplicationInfo appinfo = context.getApplicationInfo();
    if (appinfo.icon != 0) {
        appIcon = appinfo.icon;
    } else {
        Log_w(TAG, "unable to find application icon");
    }
    if (appinfo.labelRes != 0) {
        appName = context.getString(appinfo.labelRes);
    } else {
        Log_w(TAG, "unable to find application label");
    }
    if (new File(appinfo.sourceDir).lastModified() > preferences.getLong(MD5_TIME, 0)) {
        preferences.edit().putString(MD5_KEY, MD5Hex(appinfo.sourceDir)).commit();
        preferences.edit().putLong(MD5_TIME, System.currentTimeMillis()).commit();

        String update_file = preferences.getString(UPDATE_FILE, "");
        if (update_file.length() > 0) {
            if (new File(context.getFilesDir().getAbsolutePath() + "/" + update_file).delete()) {
                preferences.edit().remove(UPDATE_FILE).remove(SILENT_FAILED).commit();
            }
        }
    }
    raise_notification();

    if (haveInternetPermissions()) {
        context.registerReceiver(connectivity_receiver,
                new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    }
}

From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteSchedulesDayDeparturesFragment.java

@Override
public void onResume() {
    super.onResume();

    IntentFilter filter = new IntentFilter(
            "gov.wa.wsdot.android.wsdot.intent.action.FERRIES_TERMINAL_SAILING_SPACE_RESPONSE");
    filter.addCategory(Intent.CATEGORY_DEFAULT);
    ferriesTerminalSyncReceiver = new FerriesTerminalSyncReceiver();
    getActivity().registerReceiver(ferriesTerminalSyncReceiver, filter);
}

From source file:net.majorkernelpanic.spydroid.SpydroidActivity.java

public void onResume() {
    super.onResume();
    // Determines if user is connected to a wireless network & displays ip 
    if (!streaming)
        displayIpAddress();/*from w  w  w  .j a  va2  s .  c om*/
    startServers();
    registerReceiver(wifiStateReceiver, new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION));
}

From source file:com.chasetech.pcount.autoupdate.AutoUpdateApk.java

private void setupVariables(Context ctx) {
    context = ctx;// w  w w .j  av a2 s  . c o m

    packageName = context.getPackageName();
    preferences = context.getSharedPreferences(packageName + "_" + TAG, Context.MODE_PRIVATE);
    device_id = crc32(Secure.getString(context.getContentResolver(), Secure.ANDROID_ID));
    last_update = preferences.getLong("last_update", 0);
    NOTIFICATION_ID += crc32(packageName);
    //      schedule.add(new ScheduleEntry(0,24));

    ApplicationInfo appinfo = context.getApplicationInfo();
    if (appinfo.icon != 0) {
        appIcon = appinfo.icon;
    } else {
        Log_w(TAG, "unable to find application icon");
    }
    if (appinfo.labelRes != 0) {
        appName = context.getString(appinfo.labelRes);
    } else {
        Log_w(TAG, "unable to find application label");
    }

    if (new File(appinfo.sourceDir).lastModified() > preferences.getLong(MD5_TIME, 0)) {
        preferences.edit().putString(MD5_KEY, MD5Hex(appinfo.sourceDir)).commit();
        preferences.edit().putLong(MD5_TIME, System.currentTimeMillis()).commit();

        String update_file = preferences.getString(UPDATE_FILE, "");
        if (update_file.length() > 0) {
            if (new File(context.getFilesDir().getAbsolutePath() + "/" + update_file).delete()) {
                preferences.edit().remove(UPDATE_FILE).remove(SILENT_FAILED).commit();
            }
        }
    }
    raise_notification();

    if (haveInternetPermissions()) {
        context.registerReceiver(connectivity_receiver,
                new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    }
}

From source file:com.example.suspectedBug.myapplication.IapSampleActivity.java

@Override
protected void onResume() {
    super.onResume();

    // Register to receive notifications about account changes. This will re-query
    // the receipt list in order to ensure it is always up to date for whomever
    // is logged in.
    IntentFilter accountsChangedFilter = new IntentFilter(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION);
    registerReceiver(mAuthChangeReceiver, accountsChangedFilter);
}