//这个方法就是我们deepLink的打开,只要传入要打开的链接就行 public static void openDeeplink(Context context, String deepLink) { Intent intent = null; if (null == context || TextUtils.isEmpty(deepLink)) return; try { intent = Intent.parseUri(deepLink, Intent.URI_INTENT_SCHEME); } catch (URISyntaxException e) { // Log.e(TAG, "URISyntaxException: " + e.getLocalizedMessage()); } if (intent != null) { intent.setComponent(null); try { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } catch (ActivityNotFoundException e) { // Log.e(TAG, "ActivityNotFoundException: " + e.getLocalizedMessage()); } } }
Deeplink的打开方式
最新推荐文章于 2024-08-26 14:29:47 发布