Search in sources :

Example 6 with IntentFilter

use of android.content.IntentFilter in project PlayerHater by chrisrhoden.

the class BroadcastReceiver method register.

public static void register(Context context) {
    BroadcastReceiver receiver = new BroadcastReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_HEADSET_PLUG);
    filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    filter.addAction(Intent.ACTION_MEDIA_BUTTON);
    filter.setPriority(10000);
    context.registerReceiver(receiver, filter);
    sInstance = receiver;
}
Also used : IntentFilter(android.content.IntentFilter)

Example 7 with IntentFilter

use of android.content.IntentFilter in project GeekNews by codeestX.

the class UpdateService method onStartCommand.

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    receiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            unregisterReceiver(receiver);
            intent = new Intent(Intent.ACTION_VIEW);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/geeknews.apk")), "application/vnd.android.package-archive");
            startActivity(intent);
            stopSelf();
        }
    };
    registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
    startDownload();
    return Service.START_STICKY;
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) File(java.io.File)

Example 8 with IntentFilter

use of android.content.IntentFilter in project cw-advandroid by commonsguy.

the class OrderedActivity method onResume.

@Override
public void onResume() {
    super.onResume();
    IntentFilter filter = new IntentFilter(NoticeService.BROADCAST);
    filter.setPriority(2);
    registerReceiver(onNotice, filter);
}
Also used : IntentFilter(android.content.IntentFilter)

Example 9 with IntentFilter

use of android.content.IntentFilter in project cw-omnibus by commonsguy.

the class EventLogFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    IntentFilter filter = new IntentFilter(ACTION_EVENT);
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(onEvent, filter);
}
Also used : IntentFilter(android.content.IntentFilter)

Example 10 with IntentFilter

use of android.content.IntentFilter in project cw-omnibus by commonsguy.

the class BatteryFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    IntentFilter f = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
    getActivity().registerReceiver(onBattery, f);
}
Also used : IntentFilter(android.content.IntentFilter)

Aggregations

IntentFilter (android.content.IntentFilter)1441 Intent (android.content.Intent)493 Context (android.content.Context)292 BroadcastReceiver (android.content.BroadcastReceiver)274 PendingIntent (android.app.PendingIntent)148 RemoteException (android.os.RemoteException)80 ComponentName (android.content.ComponentName)54 Handler (android.os.Handler)53 View (android.view.View)45 Test (org.junit.Test)41 Uri (android.net.Uri)40 PowerManager (android.os.PowerManager)38 ArrayList (java.util.ArrayList)37 TextView (android.widget.TextView)36 ResolveInfo (android.content.pm.ResolveInfo)30 File (java.io.File)29 Point (android.graphics.Point)28 PackageManager (android.content.pm.PackageManager)27 IOException (java.io.IOException)25 HandlerThread (android.os.HandlerThread)24