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.ideateam.plugin.IsOnline.java

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    // TODO Auto-generated method stub
    super.initialize(cordova, webView);

    activity = this.cordova.getActivity();
    activity.registerReceiver(mConnReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));

}

From source file:com.gigathinking.simpleapplock.ResetUnlockMethod.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_reset);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    mDialog = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER);
    mDialog.setIndeterminate(true);//from w ww.j  a  va  2  s.  c o  m
    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    mResetReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            prefs.edit().putString(AppLockApplication.LOCKTYPE, AppLockApplication.LOCKTYPE_PIN).commit();
            prefs.edit()
                    .putString(AppLockApplication.PASSWORD, intent.getStringExtra(AppLockApplication.PASSWORD))
                    .commit();
            Toast.makeText(context, getString(R.string.pin_reset), Toast.LENGTH_LONG).show();
            startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)
                    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
            //startActivity(new Intent(ResetUnlockMethod.this,UnlockWithPIN.class).putExtra("test","test"));
            finish();
        }
    };
    LocalBroadcastManager.getInstance(this).registerReceiver(mResetReceiver,
            new IntentFilter(AppLockApplication.RESET_UNLOCK));

    if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.register_complete),
            false)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(getString(R.string.reset_register_device));
        builder.setTitle(getString(R.string.info));
        builder.setPositiveButton(getString(R.string.register), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                new Register().execute();
                if (mDialog != null) {
                    mDialog.setMessage(getString(R.string.register_ongoing));
                    mDialog.show();
                }
                dialog.dismiss();
            }
        });
        builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                finish();
                Intent intent = new Intent(Intent.ACTION_MAIN);
                intent.addCategory(Intent.CATEGORY_HOME);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
            }
        });
        builder.create().show();
    } else {
        if (mDialog != null) {
            mDialog.setMessage(getString(R.string.connect_to_server));
            mDialog.show();
        }
        new DoRequestReset().execute();
    }
}

From source file:com.polyvi.xface.extension.bluetooth.XBluetoothExt.java

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    mCordova = cordova;//  w  ww  .  j  av  a  2s .c om
    try {
        mBtadapter = BluetoothAdapter.getDefaultAdapter();
    } catch (RuntimeException e) {
        XLog.e(CLASS_NAME, "init: RuntimeException");
        return;
    }
    mFoundDevices = new ArrayList<BluetoothDevice>();
    Context context = cordova.getActivity();

    IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
    context.registerReceiver(mReceiver, filter);

    filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
    context.registerReceiver(mReceiver, filter);

    filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    context.registerReceiver(mReceiver, filter);

    filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
    context.registerReceiver(mReceiver, filter);
}

From source file:com.pushwoosh.plugin.pushnotifications.PushNotifications.java

public void registerReceivers() {
    if (receiversRegistered)
        return;//from   w ww .j av  a2 s. c  o m

    IntentFilter intentFilter = new IntentFilter(
            cordova.getActivity().getPackageName() + ".action.PUSH_MESSAGE_RECEIVE");

    //comment this code out if you would like to receive the notifications in the notifications center when the app is in foreground
    cordova.getActivity().registerReceiver(mReceiver, intentFilter);

    //registration receiver
    cordova.getActivity().registerReceiver(mBroadcastReceiver, new IntentFilter(
            cordova.getActivity().getPackageName() + "." + PushManager.REGISTER_BROAD_CAST_ACTION));

    receiversRegistered = true;
}

From source file:com.polyvi.xface.extension.XTelephonyExt.java

@Override
public void init(XExtensionContext extensionContext, XIWebContext webContext) {
    super.init(extensionContext, webContext);
    mContentResolver = getContext().getContentResolver();
    genIncomingCallBroadcastReceiver();//from   w w  w.jav  a2  s  . c  o m
    getContext().registerReceiver(mIncomingCallBroadcastReceiver, new IntentFilter(ACTION_PHONE_STATE_CHANGED));
}

From source file:com.samsung.richnotification.RichNotification.java

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    String mPackageName = cordova.getActivity().getPackageName();
    PackageManager pm = cordova.getActivity().getPackageManager();
    try {//  ww  w.j a  va  2 s. c o m
        ApplicationInfo ai = pm.getApplicationInfo(mPackageName, PackageManager.GET_META_DATA);
        if (ai.metaData != null) {
            pluginMetadata = ai.metaData.getBoolean(META_DATA);
        }
    } catch (NameNotFoundException e) {
    }
    IntentFilter filter = new IntentFilter("com.samsung.cordova.richnotification.remote_input_receiver");
    if (richRemoteInputReceiver != null) {
        cordova.getActivity().getApplicationContext().registerReceiver(richRemoteInputReceiver, filter);
    }
}

From source file:com.ideateam.plugin.IsOnline.java

@Override
public void onResume(boolean multitasking) {
    // TODO Auto-generated method stub

    this.cordova.getActivity().registerReceiver(mConnReceiver,
            new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    super.onResume(multitasking);

}

From source file:mobi.monaca.framework.plugin.BluetoothPlugin.java

/**
 * Register receiver as soon as we have the context
 *//*from   ww  w. j  av a  2 s. c  o  m*/
@Override
public void setContext(CordovaInterface ctx) {
    super.setContext(ctx);

    //TODO fixed
    // Register for necessary bluetooth events
    ctx.getActivity().registerReceiver(m_bpBroadcastReceiver,
            new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED));
    ctx.getActivity().registerReceiver(m_bpBroadcastReceiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));
    ctx.getActivity().registerReceiver(m_bpBroadcastReceiver, new IntentFilter(BluetoothPlugin.ACTION_UUID));
    //ctx.registerReceiver(m_bpBroadcastReceiver, new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
}

From source file:mai.whack.StickyNotesActivity.java

/** Called when the activity is first created. */
@Override/*  w  ww . j a v  a2 s .c o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mNfcAdapter = NfcAdapter.getDefaultAdapter(this);

    setContentView(R.layout.main);
    findViewById(R.id.write_tag).setOnClickListener(mTagWriter);

    // Handle all of our received NFC intents in this activity.
    mNfcPendingIntent = PendingIntent.getActivity(this, 0,
            new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

    // Intent filters for reading a note from a tag or exchanging over p2p.
    IntentFilter ndefDetected = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
    try {
        ndefDetected.addDataType("text/plain");
    } catch (MalformedMimeTypeException e) {
    }
    mNdefExchangeFilters = new IntentFilter[] { ndefDetected };

    // Intent filters for writing to a tag
    IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED);
    mWriteTagFilters = new IntentFilter[] { tagDetected };
}

From source file:com.markupartist.sthlmtraveling.FavoritesFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getActivity().registerReceiver(mUpdateUIReceiver,
            new IntentFilter("sthlmtraveling.intent.action.UPDATE_UI"));
}