android.content.Intent.getScheme()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(267)

本文整理了Java中android.content.Intent.getScheme()方法的一些代码示例,展示了Intent.getScheme()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.getScheme()方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:getScheme

Intent.getScheme介绍

暂无

代码示例

代码示例来源:origin: android-hacker/VirtualXposed

@Override
public boolean activitySupportsIntent(ComponentName component, Intent intent, String resolvedType) {
  synchronized (mPackages) {
    VPackage.ActivityComponent a = mActivities.mActivities.get(component);
    if (a == null) {
      return false;
    }
    for (int i = 0; i < a.intents.size(); i++) {
      if (a.intents.get(i).filter.match(intent.getAction(), resolvedType, intent.getScheme(), intent.getData(),
          intent.getCategories(), TAG) >= 0) {
        return true;
      }
    }
    return false;
  }
}

代码示例来源:origin: android-hacker/VirtualXposed

public List<R> queryIntentFromList(Intent intent, String resolvedType, boolean defaultOnly,
    ArrayList<F[]> listCut, int userId) {
  ArrayList<R> resultList = new ArrayList<R>();
  FastImmutableArraySet<String> categories = getFastIntentCategories(intent);
  final String scheme = intent.getScheme();
  int N = listCut.size();
  for (int i = 0; i < N; ++i) {
    buildResolveList(intent, categories, defaultOnly, resolvedType, scheme, listCut.get(i), resultList, userId);
  }
  sortResults(resultList);
  return resultList;
}

代码示例来源:origin: robolectric/robolectric

private static int matchIntentFilter(Intent intent, IntentFilter intentFilter) {
 return intentFilter.match(
   intent.getAction(),
   intent.getType(),
   intent.getScheme(),
   intent.getData(),
   intent.getCategories(),
   TAG);
}

代码示例来源:origin: robolectric/robolectric

/** Returns the BroadcaseReceivers wrappers, matching intent's action and permissions. */
private List<Wrapper> getAppropriateWrappers(Intent intent, String receiverPermission) {
 broadcastIntents.add(intent);
 List<Wrapper> result = new ArrayList<>();
 List<Wrapper> copy = new ArrayList<>();
 copy.addAll(registeredReceivers);
 for (Wrapper wrapper : copy) {
  if (hasMatchingPermission(wrapper.broadcastPermission, receiverPermission)
    && wrapper.intentFilter.matchAction(intent.getAction())) {
   final int match =
     wrapper.intentFilter.matchData(intent.getType(), intent.getScheme(), intent.getData());
   if (match != IntentFilter.NO_MATCH_DATA && match != IntentFilter.NO_MATCH_TYPE) {
    result.add(wrapper);
   }
  }
 }
 return result;
}

代码示例来源:origin: robolectric/robolectric

@Implementation
protected boolean sendBroadcast(Intent intent) {
 boolean sent = false;
 sentBroadcastIntents.add(intent);
 List<Wrapper> copy = new ArrayList<>();
 copy.addAll(registeredReceivers);
 for (Wrapper wrapper : copy) {
  if (wrapper.intentFilter.matchAction(intent.getAction())) {
   final int match = wrapper.intentFilter.matchData(intent.getType(), intent.getScheme(), intent.getData());
   if (match != IntentFilter.NO_MATCH_DATA && match != IntentFilter.NO_MATCH_TYPE) {
    sent = true;
    final BroadcastReceiver receiver = wrapper.broadcastReceiver;
    final Intent broadcastIntent = intent;
    Robolectric.getForegroundThreadScheduler().post(new Runnable() {
     @Override
     public void run() {
      receiver.onReceive(RuntimeEnvironment.application, broadcastIntent);
     }
    });
   }
  }
 }
 return sent;
}

代码示例来源:origin: android-hacker/VirtualXposed

public List<R> queryIntent(Intent intent, String resolvedType, boolean defaultOnly, int userId) {
  String scheme = intent.getScheme();

代码示例来源:origin: Tencent/tinker

final IntentFilter intentFilter = item.getValue();
final int matchRes = intentFilter.match(intent.getAction(), intent.getType(),
    intent.getScheme(), intent.getData(), intent.getCategories(), TAG);
final boolean matches = (matchRes != IntentFilter.NO_MATCH_ACTION)
    && (matchRes != IntentFilter.NO_MATCH_CATEGORY)

代码示例来源:origin: termux/termux-app

final String action = intent.getAction();
final String type = intent.getType();
final String scheme = intent.getScheme();

代码示例来源:origin: robolectric/robolectric

@Test
public void testGetScheme() throws Exception {
 Intent intent = new Intent();
 Uri uri = Uri.parse("http://robolectric.org");
 assertSame(intent, intent.setData(uri));
 assertSame(uri, intent.getData());
 assertEquals("http", intent.getScheme());
}

代码示例来源:origin: android-hacker/VirtualXposed

&& "package".equals(intent.getScheme())) {
  args[intentIndex - 1] = getHostPkg();
if (intent.getScheme() != null && intent.getScheme().equals(SCHEME_PACKAGE) && intent.getData() != null) {
  if (intent.getAction() != null && intent.getAction().startsWith("android.settings.")) {
    intent.setData(Uri.parse("package:" + getHostPkg()));

代码示例来源:origin: limpoxe/Android-Plugin-Framework

private static ArrayList<String> findClassNameByIntent(Intent intent, HashMap<String, ArrayList<PluginIntentFilter>> intentFilter) {
  if (intentFilter != null) {
    ArrayList<String> targetClassNameList = null;
    Iterator<Map.Entry<String, ArrayList<PluginIntentFilter>>> entry = intentFilter.entrySet().iterator();
    while (entry.hasNext()) {
      Map.Entry<String, ArrayList<PluginIntentFilter>> item = entry.next();
      Iterator<PluginIntentFilter> values = item.getValue().iterator();
      while (values.hasNext()) {
        PluginIntentFilter filter = values.next();
        int result = filter.match(intent.getAction(), intent.getType(), intent.getScheme(),
            intent.getData(), intent.getCategories());
        if (result != PluginIntentFilter.NO_MATCH_ACTION
            && result != PluginIntentFilter.NO_MATCH_CATEGORY
            && result != PluginIntentFilter.NO_MATCH_DATA
            && result != PluginIntentFilter.NO_MATCH_TYPE) {
          if (targetClassNameList == null) {
            targetClassNameList = new ArrayList<String>();
          }
          targetClassNameList.add(item.getKey());
        }
      }
    }
    return targetClassNameList;
  }
  return null;
}

代码示例来源:origin: jberkel/sms-backup-plus

private void handleRedirectIntent(Intent intent) {
    if (OAuth2Client.REDIRECT_URL.getScheme().equals(intent.getScheme())) {
      final String code = intent.getData().getQueryParameter("code");
      final String error = intent.getData().getQueryParameter("error");

      App.post(new BrowserAuthResult(code, error));
    }
    finish();
  }
}

代码示例来源:origin: limpoxe/Android-Plugin-Framework

/**
 * Test whether this filter matches the given <var>intent</var>.
 *
 * @param intent The Intent to compare against.
 * @param resolve If true, the intent's type will be resolved by calling
 *                Intent.resolveType(); otherwise a simple match against
 *                Intent.type will be performed.
 * @param logTag Tag to use in debugging messages.
 *
 * @return Returns either a valid match constant (a combination of
 * {@link #MATCH_CATEGORY_MASK} and {@link #MATCH_ADJUSTMENT_MASK}),
 * or one of the error codes {@link #NO_MATCH_TYPE} if the type didn't match,
 * {@link #NO_MATCH_DATA} if the scheme/path didn't match,
 * {@link #NO_MATCH_ACTION if the action didn't match, or
 * {@link #NO_MATCH_CATEGORY} if one or more categories didn't match.
 *
 * @return How well the filter matches.  Negative if it doesn't match,
 *         zero or positive positive value if it does with a higher
 *         value representing a better match.
 *
 * @see #match(String, String, String, android.net.Uri , Set, String)
 */
public final int match(ContentResolver resolver, Intent intent,
    boolean resolve, String logTag) {
  String type = resolve ? intent.resolveType(resolver) : intent.getType();
  return match(intent.getAction(), type, intent.getScheme(),
         intent.getData(), intent.getCategories());
}

代码示例来源:origin: stackoverflow.com

@Override
protected void onNewIntent(final Intent intent) {
 ...
 if (intent.getScheme().equals(..)) {
  ..
 }
}

代码示例来源:origin: stackoverflow.com

protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
Intent deepLinkingIntent= getIntent();
deepLinkingIntent.getScheme();
deepLinkingIntent.getData().getPath();
}

代码示例来源:origin: stackoverflow.com

Intent intent = getIntent();
 String action = intent.getAction();
 Uri data = intent.getData();
 String link = intent.getScheme();
 String linkData = intent.getDataString();
 Log.d("TMS","action is: " + action);
 Log.d("TMS","link is: " + link);
 Log.d("TMS","linkData is: " + linkData);

代码示例来源:origin: stackoverflow.com

@Override
   protected void onActivityResult(int requestCode, int resultCode, Intent i) {
    if (i!=null){        
     i.getPackage();
     i.getExtras();
     i.getData();
     i.getScheme();
     i.getType();
     }
   }

代码示例来源:origin: ximsfei/Android-plugin-support

public List<ResolveInfo> queryIntentFromList(Intent intent, String resolvedType,
                    ArrayList<DynamicApkParser.ActivityIntentInfo[]> listCut) {
  ArrayList<ResolveInfo> resultList = new ArrayList();
  FastImmutableArraySet<String> categories = getFastIntentCategories(intent);
  final String scheme = intent.getScheme();
  int N = listCut.size();
  for (int i = 0; i < N; ++i) {
    buildResolveList(intent, categories,
        resolvedType, scheme, listCut.get(i), resultList);
  }
  sortResults(resultList);
  return resultList;
}

代码示例来源:origin: darkskygit/VirtualApp

public List<R> queryIntentFromList(Intent intent, String resolvedType, boolean defaultOnly,
    ArrayList<F[]> listCut, int userId) {
  ArrayList<R> resultList = new ArrayList<R>();
  FastImmutableArraySet<String> categories = getFastIntentCategories(intent);
  final String scheme = intent.getScheme();
  int N = listCut.size();
  for (int i = 0; i < N; ++i) {
    buildResolveList(intent, categories, defaultOnly, resolvedType, scheme, listCut.get(i), resultList, userId);
  }
  sortResults(resultList);
  return resultList;
}

代码示例来源:origin: bzsome/VirtualApp-x326

public List<R> queryIntentFromList(Intent intent, String resolvedType, boolean defaultOnly,
    ArrayList<F[]> listCut, int userId) {
  ArrayList<R> resultList = new ArrayList<R>();
  FastImmutableArraySet<String> categories = getFastIntentCategories(intent);
  final String scheme = intent.getScheme();
  int N = listCut.size();
  for (int i = 0; i < N; ++i) {
    buildResolveList(intent, categories, defaultOnly, resolvedType, scheme, listCut.get(i), resultList, userId);
  }
  sortResults(resultList);
  return resultList;
}

相关文章

Intent类方法