Java Code Examples for android.content.IntentFilter#addDataPath()
The following examples show how to use
android.content.IntentFilter#addDataPath() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: android_9.0.0_r45 File: TrustAgentWrapper.java License: Apache License 2.0 | 5 votes |
public TrustAgentWrapper(Context context, TrustManagerService trustManagerService, Intent intent, UserHandle user) { mContext = context; mTrustManagerService = trustManagerService; mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); mUserId = user.getIdentifier(); mName = intent.getComponent(); mAlarmIntent = new Intent(TRUST_EXPIRED_ACTION).putExtra(EXTRA_COMPONENT_NAME, mName); mAlarmIntent.setData(Uri.parse(mAlarmIntent.toUri(Intent.URI_INTENT_SCHEME))); mAlarmIntent.setPackage(context.getPackageName()); final IntentFilter alarmFilter = new IntentFilter(TRUST_EXPIRED_ACTION); alarmFilter.addDataScheme(mAlarmIntent.getScheme()); final String pathUri = mAlarmIntent.toUri(Intent.URI_INTENT_SCHEME); alarmFilter.addDataPath(pathUri, PatternMatcher.PATTERN_LITERAL); // Schedules a restart for when connecting times out. If the connection succeeds, // the restart is canceled in mCallback's onConnected. scheduleRestart(); mBound = context.bindServiceAsUser(intent, mConnection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE, user); if (mBound) { mContext.registerReceiver(mBroadcastReceiver, alarmFilter, PERMISSION, null); } else { Log.e(TAG, "Can't bind to TrustAgent " + mName.flattenToShortString()); } }
Example 2
Source Project: fdroidclient File: Installer.java License: GNU General Public License v3.0 | 5 votes |
/** * Gets an {@link IntentFilter} for matching events from the install * process based on {@code canonicalUri}, which is the global unique * ID for a package going through the install process. * * @see InstallManagerService for more about {@code canonicalUri} */ public static IntentFilter getInstallIntentFilter(Uri canonicalUri) { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Installer.ACTION_INSTALL_STARTED); intentFilter.addAction(Installer.ACTION_INSTALL_COMPLETE); intentFilter.addAction(Installer.ACTION_INSTALL_INTERRUPTED); intentFilter.addAction(Installer.ACTION_INSTALL_USER_INTERACTION); intentFilter.addDataScheme(canonicalUri.getScheme()); intentFilter.addDataAuthority(canonicalUri.getHost(), String.valueOf(canonicalUri.getPort())); intentFilter.addDataPath(canonicalUri.getPath(), PatternMatcher.PATTERN_LITERAL); return intentFilter; }
Example 3
Source Project: fdroidclient File: Installer.java License: GNU General Public License v3.0 | 5 votes |
public static IntentFilter getUninstallIntentFilter(String packageName) { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Installer.ACTION_UNINSTALL_STARTED); intentFilter.addAction(Installer.ACTION_UNINSTALL_COMPLETE); intentFilter.addAction(Installer.ACTION_UNINSTALL_INTERRUPTED); intentFilter.addAction(Installer.ACTION_UNINSTALL_USER_INTERACTION); intentFilter.addDataScheme("package"); intentFilter.addDataPath(packageName, PatternMatcher.PATTERN_LITERAL); return intentFilter; }
Example 4
Source Project: fdroidclient File: DownloaderService.java License: GNU General Public License v3.0 | 5 votes |
/** * Get a prepared {@link IntentFilter} for use for matching this service's action events. * * @param canonicalUrl the URL used as the unique ID for the specific package */ public static IntentFilter getIntentFilter(String canonicalUrl) { Uri uri = Uri.parse(canonicalUrl); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Downloader.ACTION_STARTED); intentFilter.addAction(Downloader.ACTION_PROGRESS); intentFilter.addAction(Downloader.ACTION_COMPLETE); intentFilter.addAction(Downloader.ACTION_INTERRUPTED); intentFilter.addAction(Downloader.ACTION_CONNECTION_FAILED); intentFilter.addDataScheme(uri.getScheme()); intentFilter.addDataAuthority(uri.getHost(), String.valueOf(uri.getPort())); intentFilter.addDataPath(uri.getPath(), PatternMatcher.PATTERN_LITERAL); return intentFilter; }
Example 5
Source Project: soot-infoflow-android-iccta File: IntentFilterDB.java License: GNU Lesser General Public License v2.1 | 4 votes |
public IntentFilter toIntentFilter(int type) { if (1 == type) { return toIntentFilter(); } IntentFilter filter = toIntentFilter(); try { //for mimetype if (type >= 1) { if (! StringUtil.isEmpty(dataAndType.getType())) { if (! StringUtil.isEmpty(dataAndType.getSubtype())) { filter.addDataType(dataAndType.getType() + "/" + dataAndType.getSubtype()); filterType = 2; } else { filter.addDataType(dataAndType.getType()); filterType = 2; } } } //for data if (type >= 2) { if (! StringUtil.isEmpty(dataAndType.getHost())) { if (! StringUtil.isEmpty(dataAndType.getPort())) { filter.addDataAuthority(dataAndType.getHost(), dataAndType.getPort()); } else { filter.addDataAuthority(dataAndType.getHost(), null); } filterType = 3; } if (! StringUtil.isEmpty(dataAndType.getPath())) { filter.addDataPath(dataAndType.getPath(), PatternMatcher.PATTERN_LITERAL); filterType = 3; } if (! StringUtil.isEmpty(dataAndType.getScheme())) { filter.addDataScheme(dataAndType.getScheme()); filterType = 3; } } } catch (Exception ex) { ex.printStackTrace(); } return filter; }
Example 6
Source Project: Telephoto File: TaskerIntent.java License: Apache License 2.0 | 3 votes |
public static IntentFilter getCompletionFilter( String taskName ) { IntentFilter filter = new IntentFilter( TaskerIntent.ACTION_TASK_COMPLETE ); filter.addDataScheme( TASK_NAME_DATA_SCHEME ); filter.addDataPath( taskName, PatternMatcher.PATTERN_LITERAL ); return filter; }
Example 7
Source Project: Saiy-PS File: TaskerIntent.java License: GNU Affero General Public License v3.0 | 3 votes |
public static IntentFilter getCompletionFilter( String taskName ) { IntentFilter filter = new IntentFilter( TaskerIntent.ACTION_TASK_COMPLETE ); filter.addDataScheme( TASK_NAME_DATA_SCHEME ); filter.addDataPath( taskName, PatternMatcher.PATTERN_LITERAL ); return filter; }
Example 8
Source Project: beaconloc File: TaskerIntent.java License: Apache License 2.0 | 3 votes |
public static IntentFilter getCompletionFilter(String taskName) { IntentFilter filter = new IntentFilter(TaskerIntent.ACTION_TASK_COMPLETE); filter.addDataScheme(TASK_NAME_DATA_SCHEME); filter.addDataPath(taskName, PatternMatcher.PATTERN_LITERAL); return filter; }
Example 9
Source Project: Android-nRF-Beacon File: TaskerIntent.java License: BSD 3-Clause "New" or "Revised" License | 3 votes |
public static IntentFilter getCompletionFilter(String taskName) { IntentFilter filter = new IntentFilter(TaskerIntent.ACTION_TASK_COMPLETE); filter.addDataScheme(TASK_NAME_DATA_SCHEME); filter.addDataPath(taskName, PatternMatcher.PATTERN_LITERAL); return filter; }
Example 10
Source Project: CarBusInterface File: TaskerIntent.java License: MIT License | 3 votes |
public static IntentFilter getCompletionFilter( String taskName ) { IntentFilter filter = new IntentFilter( TaskerIntent.ACTION_TASK_COMPLETE ); filter.addDataScheme( TASK_NAME_DATA_SCHEME ); filter.addDataPath( taskName, PatternMatcher.PATTERN_LITERAL ); return filter; }
Example 11
Source Project: androidwebserver File: TaskerIntent.java License: GNU General Public License v3.0 | 3 votes |
public static IntentFilter getCompletionFilter( String taskName ) { IntentFilter filter = new IntentFilter( TaskerIntent.ACTION_TASK_COMPLETE ); filter.addDataScheme( TASK_NAME_DATA_SCHEME ); filter.addDataPath( taskName, PatternMatcher.PATTERN_LITERAL ); return filter; }