当前位置: 首页>>代码示例>>Java>>正文


Java IntentFilter.addDataAuthority方法代码示例

本文整理汇总了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;
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:16,代码来源:Installer.java

示例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;
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:19,代码来源:DownloaderService.java

示例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);
}
 
开发者ID:azmedien,项目名称:kolibri-android,代码行数:29,代码来源:KolibriCoordinator.java

示例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;
}
 
开发者ID:pp3345,项目名称:YubiDroid,代码行数:16,代码来源:ConnectionManager.java


注:本文中的android.content.IntentFilter.addDataAuthority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。