Android App Link

2020-07-17  本文已影响0人  ce2f22ad95cd

1. Tools -> App links Assistant

在处理响应的activity中加入一下代码

public void onCreate(Bundle savedInstanceState) {

    handleIntent(intent);    

}

protected void onNewIntent(Intent intent) {

    super.onNewIntent(intent);

    handleIntent(intent);

}

private void handleIntent(Intent intent) {

    String appLinkAction = intent.getAction();

    Uri appLinkData = intent.getData();

    if (Intent.ACTION_VIEW.equals(appLinkAction) && appLinkData !=null){

        String recipeId = appLinkData.getLastPathSegment();

        Uri appData = Uri.parse("content://com.recipe_app/recipe/").buildUpon()

            .appendPath(recipeId).build();

        //处理获取到的信息

    }

}

上一篇 下一篇

猜你喜欢

热点阅读