List of usage examples for android.content IntentFilter addAction
public final void addAction(String action)
From source file:com.example.bluetoothlegatt.DeviceControlActivity.java
private static IntentFilter makeGattUpdateIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(BluetoothLeService.ACTION_GATT_CONNECTED); intentFilter.addAction(BluetoothLeService.ACTION_GATT_DISCONNECTED); intentFilter.addAction(BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED); intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE); return intentFilter; }
From source file:com.beestar.ble.ble.ui.BleScanActivity.java
private static IntentFilter makeIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(BleService.ACTION_BLUETOOTH_DEVICE); intentFilter.addAction(BleService.ACTION_GATT_CONNECTED); intentFilter.addAction(BleService.ACTION_GATT_DISCONNECTED); intentFilter.addAction(BleService.ACTION_SCAN_FINISHED); return intentFilter; }
From source file:com.example.bluetooth.RFduinoService.java
public static IntentFilter getIntentFilter() { IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_CONNECTED); filter.addAction(ACTION_DISCONNECTED); filter.addAction(ACTION_DATA_AVAILABLE); return filter; }
From source file:com.github.vgoliveira.panificadora.MainActivity.java
private static IntentFilter makeGattUpdateIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(UartService.ACTION_GATT_CONNECTED); intentFilter.addAction(UartService.ACTION_GATT_DISCONNECTED); intentFilter.addAction(UartService.ACTION_GATT_SERVICES_DISCOVERED); intentFilter.addAction(UartService.DEVICE_DOES_NOT_SUPPORT_UART); return intentFilter; }
From source file:fr.bmartel.android.dotti.DottiActivity.java
/** * add filter to intent to receive notification from bluetooth service * * @return intent filter// w ww .j a v a 2s .co m */ private static IntentFilter makeGattUpdateIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ActionFilterGatt.ACTION_GATT_CONNECTED); intentFilter.addAction(ActionFilterGatt.ACTION_GATT_DISCONNECTED); intentFilter.addAction(ActionFilterGatt.ACTION_GATT_SERVICES_DISCOVERED); intentFilter.addAction(ActionFilterGatt.ACTION_DATA_AVAILABLE); return intentFilter; }
From source file:com.android.contacts.DynamicShortcuts.java
public synchronized static void initialize(Context context) { if (Log.isLoggable(TAG, Log.DEBUG)) { final Flags flags = Flags.getInstance(); Log.d(TAG, "DyanmicShortcuts.initialize\nVERSION >= N_MR1? " + (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) + "\nisJobScheduled? " + (CompatUtils.isLauncherShortcutCompatible() && isJobScheduled(context)) + "\nminDelay=" + flags.getInteger(Experiments.DYNAMIC_MIN_CONTENT_CHANGE_UPDATE_DELAY_MILLIS) + "\nmaxDelay=" + flags.getInteger(Experiments.DYNAMIC_MAX_CONTENT_CHANGE_UPDATE_DELAY_MILLIS)); }//from w w w . jav a2 s . co m if (!CompatUtils.isLauncherShortcutCompatible()) return; final DynamicShortcuts shortcuts = new DynamicShortcuts(context); if (!shortcuts.hasRequiredPermissions()) { final IntentFilter filter = new IntentFilter(); filter.addAction(RequestPermissionsActivity.BROADCAST_PERMISSIONS_GRANTED); LocalBroadcastManager.getInstance(shortcuts.mContext).registerReceiver(new PermissionsGrantedReceiver(), filter); } else if (!isJobScheduled(context)) { // Update the shortcuts. If the job is already scheduled then either the app is being // launched to run the job in which case the shortcuts will get updated when it runs or // it has been launched for some other reason and the data we care about for shortcuts // hasn't changed. Because the job reschedules itself after completion this check // essentially means that this will run on each app launch that happens after a reboot. // Note: the task schedules the job after completing. new ShortcutUpdateTask(shortcuts).execute(); } }
From source file:com.example.RITW.Ble.BleProfileServiceReadyActivity.java
private static IntentFilter makeIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(BleProfileService.BROADCAST_CONNECTION_STATE); intentFilter.addAction(BleProfileService.BROADCAST_SERVICES_DISCOVERED); intentFilter.addAction(BleProfileService.BROADCAST_BOND_STATE); intentFilter.addAction(BleProfileService.BROADCAST_BATTERY_LEVEL); intentFilter.addAction(BleProfileService.BROADCAST_ERROR); return intentFilter; }
From source file:com.nordicsemi.nrfUARTv2.MainActivity.java
private static IntentFilter makeGattUpdateIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(UartService.ACTION_GATT_CONNECTED); intentFilter.addAction(UartService.ACTION_GATT_DISCONNECTED); intentFilter.addAction(UartService.ACTION_GATT_SERVICES_DISCOVERED); intentFilter.addAction(UartService.ACTION_DATA_AVAILABLE); intentFilter.addAction(UartService.DEVICE_DOES_NOT_SUPPORT_UART); return intentFilter; }
From source file:Main.java
private static final boolean initIntentFilterFromXml(IntentFilter inf, XmlPullParser xpp) { try {/* ww w.j a v a 2 s.c om*/ int outerDepth = xpp.getDepth(); int type; final String NAME = "name"; while ((type = xpp.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || xpp.getDepth() > outerDepth)) { if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) continue; String tag = xpp.getName(); if (tag.equals("action")) { String name = xpp.getAttributeValue(null, NAME); if (name != null) inf.addAction(name); } else if (tag.equals("category")) { String name = xpp.getAttributeValue(null, NAME); if (name != null) inf.addCategory(name); } else if (tag.equals("data")) { int na = xpp.getAttributeCount(); for (int i = 0; i < na; i++) { String port = null; String an = xpp.getAttributeName(i); String av = xpp.getAttributeValue(i); if ("mimeType".equals(an)) { try { inf.addDataType(av); } catch (MalformedMimeTypeException e) { } } else if ("scheme".equals(an)) { inf.addDataScheme(av); } else if ("host".equals(an)) { inf.addDataAuthority(av, port); } else if ("port".equals(an)) { port = av; } else if ("path".equals(an)) { inf.addDataPath(av, PatternMatcher.PATTERN_LITERAL); } else if ("pathPrefix".equals(an)) { inf.addDataPath(av, PatternMatcher.PATTERN_PREFIX); } else if ("pathPattern".equals(an)) { inf.addDataPath(av, PatternMatcher.PATTERN_SIMPLE_GLOB); } } } } return true; } catch (Exception e) { e.printStackTrace(); } return false; }
From source file:com.example.android.bluetoothlegatt.DeviceControlActivity.java
public static IntentFilter getIntentFilter() { final IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(BluetoothLeService.ACTION_GATT_CONNECTED); intentFilter.addAction(BluetoothLeService.ACTION_GATT_DISCONNECTED); intentFilter.addAction(BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED); intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE_READ); intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE_WRITE); intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE_NOTIFY); intentFilter.addAction(CustomParsePushReceiver.ACTION_PARSE_RECEIVE); return intentFilter; }