當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。