本文整理汇总了Java中android.content.IntentFilter.addDataAuthority方法的典型用法代码示例。如果您正苦于以下问题:Java IntentFilter.addDataAuthority方法的具体用法?Java IntentFilter.addDataAuthority怎么用?Java IntentFilter.addDataAuthority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.IntentFilter
的用法示例。
在下文中一共展示了IntentFilter.addDataAuthority方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstallIntentFilter
import android.content.IntentFilter; //导入方法依赖的package包/类
/**
* Gets an {@link IntentFilter} for matching events from the install
* process based on the original download URL as a {@link Uri}.
*/
public static IntentFilter getInstallIntentFilter(Uri uri) {
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(uri.getScheme());
intentFilter.addDataAuthority(uri.getHost(), String.valueOf(uri.getPort()));
intentFilter.addDataPath(uri.getPath(), PatternMatcher.PATTERN_LITERAL);
return intentFilter;
}
示例2: getIntentFilter
import android.content.IntentFilter; //导入方法依赖的package包/类
/**
* Get a prepared {@link IntentFilter} for use for matching this service's action events.
*
* @param urlString The full file URL to match.
*/
public static IntentFilter getIntentFilter(String urlString) {
Uri uri = Uri.parse(urlString);
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;
}
示例3: bindReceiver
import android.content.IntentFilter; //导入方法依赖的package包/类
private void bindReceiver(final T view) {
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
handleIntent(view, intent);
}
};
manager = LocalBroadcastManager.getInstance(context);
final IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_VIEW);
filter.addCategory(Intent.CATEGORY_DEFAULT);
final Uri[] uris = new Uri[kolibriUris().length];
for (int i = 0; i < uris.length; ++i) {
uris[i] = Uri.parse(kolibriUris()[i]);
final Uri uri = uris[i];
filter.addDataScheme(uri.getScheme());
filter.addDataAuthority(uri.getHost(), null);
}
manager.registerReceiver(receiver, filter);
}
示例4: onActivityResumed
import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
public void onActivityResumed(final Activity activity) {
if (this.connectReceiver == null || (this.getSupportedConnectionMethods() & CONNECTION_METHOD_NFC) == 0)
return;
final IntentFilter filter = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
filter.addDataScheme(NfcYubiKey.YUBIKEY_NEO_NDEF_SCHEME);
filter.addDataAuthority(NfcYubiKey.YUBIKEY_NEO_NDEF_HOST, null);
NfcAdapter.getDefaultAdapter(this.activity).enableForegroundDispatch(this.activity,
PendingIntent.getActivity(this.activity, -1, new Intent(this.activity, this.activity.getClass()), 0),
new IntentFilter[]{filter},
null);
this.isActivityResumed = true;
}