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.google.android.apps.santatracker.presentquest.PlacesIntentService.java

@NonNull
public static IntentFilter getNearbySearchIntentFilter() {
    return new IntentFilter(ACTION_SEARCH_NEARBY);
}

From source file:com.zeusky.star.star.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // //*from  w  ww.ja v a  2  s  .  c  o  m*/
    m_instance = this;

    MainActivity.init(this);

    StatConfig.setDebugEnable(true);
    StatService.trackCustomEvent(this, "onCreate", "");

    ShareSDKUtils.prepare(); // share sdk
    methodsRun.injectIMEI(Util.getOpenid(this));

    createSharePicDir();

    this.registerReceiver(Util.receiver, new IntentFilter( // 
            DownloadManager.ACTION_DOWNLOAD_COMPLETE));

    // Util.openAPK();
}

From source file:com.seadee.library.receiver.NetworkStateReceiver.java

public void regNetworkReciever(Context context, OnNetworkChangeListener l) {
    this.context = context;
    this.l = l;//  ww w .  j a  va 2  s  .  c o  m

    instance = this;
    IntentFilter mFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
    context.registerReceiver(this, mFilter);
}

From source file:com.mutu.gpstracker.streaming.CustomUpload.java

public static synchronized void initStreaming(Context ctx) {
    if (sCustomUpload != null) {
        shutdownStreaming(ctx);//from  w  w  w . ja va  2  s . c  om
    }
    sCustomUpload = new CustomUpload();
    sRequestBacklog = new LinkedList<HttpGet>();

    IntentFilter filter = new IntentFilter(Constants.STREAMBROADCAST);
    ctx.registerReceiver(sCustomUpload, filter);
}

From source file:com.seadee.degree.service.NetworkStateReceiver.java

public void regNetworkReciever(Context context) {
    this.context = context;
    instance = this;
    IntentFilter mFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
    context.registerReceiver(this, mFilter);
}

From source file:com.google.android.gcm.demo.app.DemoActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    checkNotNull(SERVER_URL, "SERVER_URL");
    checkNotNull(SENDER_ID, "SENDER_ID");
    // Make sure the device has the proper dependencies.
    GCMRegistrar.checkDevice(this);
    // Make sure the manifest was properly set - comment out this line
    // while developing the app, then uncomment it when it's ready.
    GCMRegistrar.checkManifest(this);
    setContentView(R.layout.main);//w  w w .  jav  a 2s . co m
    mDisplay = (TextView) findViewById(R.id.display);
    registerReceiver(mHandleMessageReceiver, new IntentFilter(DISPLAY_MESSAGE_ACTION));
    final String regId = GCMRegistrar.getRegistrationId(this);
    final Context context = this;

    if (regId.equals("")) {
        // Automatically registers application on startup.
        GCMRegistrar.register(this, SENDER_ID);
    } else {
        // Device is already registered on GCM, check server.
        if (GCMRegistrar.isRegisteredOnServer(this)) {
            // Skips registration.
            mDisplay.append(getString(R.string.already_registered) + "\n");
        } else {
            // Try to register again, but not in the UI thread.
            // It's also necessary to cancel the thread onDestroy(),
            // hence the use of AsyncTask instead of a raw thread.
            mRegisterTask = new AsyncTask<Void, Void, Void>() {

                @Override
                protected Void doInBackground(Void... params) {
                    boolean registered = ServerUtilities.register(context, regId);
                    // At this point all attempts to register with the app
                    // server failed, so we need to unregister the device
                    // from GCM - the app will try to register again when
                    // it is restarted. Note that GCM will send an
                    // unregistered callback upon completion, but
                    // GCMIntentService.onUnregistered() will ignore it.
                    if (!registered) {
                        GCMRegistrar.unregister(context);
                    }
                    return null;
                }

                @Override
                protected void onPostExecute(Void result) {
                    mRegisterTask = null;
                }

            };
            mRegisterTask.execute(null, null, null);
        }
    }

    MyTask task = new MyTask();
    task.execute();

}

From source file:jp.co.brilliantservice.android.writertdtext.HomeActivity.java

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

    mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
    if (mNfcAdapter == null) {
        Toast.makeText(getApplicationContext(), "not found NFC feature", Toast.LENGTH_SHORT).show();
        finish();/*from  w  w  w .j  a v a2 s . c om*/
        return;
    }

    if (!mNfcAdapter.isEnabled()) {
        Toast.makeText(getApplicationContext(), "NFC feature is not available", Toast.LENGTH_SHORT).show();
        finish();
        return;
    }

    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()), 0);
    IntentFilter[] intentFilter = new IntentFilter[] { new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED), };
    String[][] techList = new String[][] { { android.nfc.tech.NdefFormatable.class.getName() },
            { android.nfc.tech.Ndef.class.getName() } };
    mNfcAdapter.enableForegroundDispatch(this, pendingIntent, intentFilter, techList);

}

From source file:com.exercise.AndroidClient.AndroidClient.java

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

    // register for download mgr notifications
    registerReceiver(broadcastReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}

From source file:com.commonsware.android.qrck.SyncService.java

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

    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    network = new NetworkService(this);

    IntentFilter filter = new IntentFilter(NetworkService.ACTION_NETWORK_TAKEDOWN);

    registerReceiver(takedownReceiver, filter);
}

From source file:csic.ceab.movelab.beepath.SensorGet.java

private void trySensing() {
    stopReceiver = null;//  w w w . j a v a  2s.  com
    if (sensorsInProgress == false) {
        sensorsInProgress = true;

        sdpList = new ArrayList<SensorDataPoint>();

        stopFilter = new IntentFilter(
                getResources().getString(R.string.internal_message_id) + Util.MESSAGE_STOP_FIXGET);
        stopReceiver = new StopReceiver();
        registerReceiver(stopReceiver, stopFilter);

        registerListener();

    }
}