protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setDarkStatusIcon(); setContentView(R.layout.image_detail); AGConnectAppLinking.getInstance().getAppLinking(ImageDetailActivity.this) .addOnSuccessListener(resolvedLinkData - > { // The user has installed and used your app and the app is opened. if (resolvedLinkData != null) { Uri deepLink = resolvedLinkData.getDeepLink(); Log.i(TAG, "Open From AppLinking:" + deepLink); // Obtain the image details. getSharePicDetails(deepLink.toString()); } }).addOnFailureListener(e - > { Bundle data = getIntent().getExtras(); if (data != null) { if (data.getBoolean("firstLink")) { // The user has just installed your app and the app is opened for the first time. getSharePicDetails(data.getString("deepLink")); } else { // Open the ImageDetail page. initView(); } } }); } /** * Receive the image details from the link of App Linking, which is shared by the user. * * @param link input a deepLink of App Linking */ private void getSharePicDetails(String link) { ToastUtils.showToast(this, getResources().getString(R.string.loading_photo)); sharePhotoID = parseLink(link).get("PhotoID"); Log.i("AppLinking", "sharePhotoID: " + sharePhotoID); } /** * Obtain the data of the deep link of App Linking. * * @param url input the received deepLink * @return myMap output the param */ public static Map < String, String > parseLink(String url) { Map < String, String > myMap = new HashMap < String, String > (); String[] urlParts = url.split("\\?"); String[] params = urlParts[1].split("&"); for (String param: params) { String[] keyValue = param.split("="); myMap.put(keyValue[0], keyValue[1]); } return myMap; }