简体   繁体   English

如何在Cordova Android应用程序中深度链接到特定页面?

[英]How to deeplink to specific page in cordova android app?

I am using launchmyapp plugin to create scheme url for my cordova android app. 我正在使用launchmyapp插件为我的cordova android应用创建方案网址。 I have created myapp:// as my scheme and am using intent://scan/#Intent;scheme=myapp://;S.browser_fallback_url=https://play.google.com/store/apps/details?id=org.myapp;end inside an <a> tag to open the app from web browser. 我已经创建了myapp://作为我的计划,并且正在使用intent://scan/#Intent;scheme=myapp://;S.browser_fallback_url=https://play.google.com/store/apps/details?id=org.myapp;end<a>标记内intent://scan/#Intent;scheme=myapp://;S.browser_fallback_url=https://play.google.com/store/apps/details?id=org.myapp;end以从Web浏览器打开该应用。

Now when I want to open any specific page (like settings page) of my app using the scheme URL. 现在,当我想使用方案URL打开应用程序的任何特定页面(例如设置页面)时。 I tried using myapp://settings as suggested on the plugin's page but it doesn't seem to work. 我尝试按照插件页面上的建议使用myapp://settings ,但它似乎不起作用。 Again the homepage of my app is only getting opened. 同样,我的应用程序的主页仅被打开。

I have tried this answer , but it doesn't seem to work. 我已经试过这个答案 ,但是似乎没有用。 Any help is much appreciated. 任何帮助深表感谢。

I had achieved this using cordova-universal-links-plugin 我已经使用cordova-universal-links-plugin实现了

step 1 : install cordova-universal-links-plugin 步骤1:安装cordova-universal-links-plugin

step 2 : add below tag in your project's config file 第2步:在项目的配置文件中添加以下标记

<universal-links>
    <host name="yourappname.com" scheme="http">
        <path event="launchedAppFromLink" url="*" />
    </host>
</universal-links>

step 3 : Subscribe the above event "launchedAppFromLink" on device ready event. 步骤3:在设备就绪事件上订阅上述事件“ launchedAppFromLink”。 by adding below code 通过添加以下代码

universalLinks.subscribe('launchedAppFromLink', 
onApplicationDidLaunchFromLink);

function onApplicationDidLaunchFromLink(eventData) {

  console.log('Did launch app from the link: ' + eventData.url);

}

after this your app link will be like : http://yourappname.com/ 之后,您的应用程序链接将类似于:http: //yourappname.com/

step 4 : on clicking above link if your app is installed in device then it will open. 第4步:如果您的应用程序已安装在设备上,请单击上面的链接,它将打开。

step 5 : to open app specific register on branch.io 步骤5:在branch.io上打开应用程序特定的注册

step 6 : register your app. 第6步:注册您的应用。 After app registration it gives a link which is used to redirect or open the app. 应用注册后,它会提供一个用于重定向或打开应用的链接。

step 7 : after that link just add your page name for example "myappname.app.link/yourapppage.html" and it will open that same page in mobile if your app is installed and if not then it will redirect to playstore with your app link 第7步:在该链接之后,只需添加您的页面名称即可,例如“ myappname.app.link/yourapppage.html”,如果已安装您的应用程序,它将在移动设备中打开该页面,否则,它将与您的应用程序重定向到playstore链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM