简体   繁体   English

使用链接共享我的对象-ionic3

[英]Share my objects using a link - ionic3

I'm imagining this situation: I have my app opened on my device. 我正在想象这种情况:我在设备上打开了我的应用程序。 I've just created a new element (object) in my app, for example a new Film like this 我刚刚在我的应用中创建了一个新元素(对象),例如新的电影

film = {
    title: 'Shark 3',
    subtitle: 'the revenge',
    date: '12-11-2019',
    plot: '...'
};

and I've saved it in my local storage. 并且已将其保存在本地存储中。 Now I want to share it on socials (WhatsApp, Facebook...) generating a link to this object. 现在,我想在社交网站(WhatsApp,Facebook ...)上共享它,以生成指向该对象的链接。 By clicking on this link I want my app (or the app store if it is not installed) to open. 通过单击此链接,我希望我的应用程序(或未安装的应用程序商店)打开。 In case my app is installed, it should display a page with the film's information. 如果安装了我的应用程序,它将显示一个包含电影信息的页面。 Is it possible? 可能吗? How to do this in ionic? 如何在离子中做到这一点?

The data you want to present is stored within the app and so available on every device your app is installed, I guess? 您想呈现的数据存储在应用程序内,因此在您安装应用程序的每台设备上都可以使用吗? Or is it data loaded from a backend? 还是从后端加载数据?

What you want to do is called a Deep Link. 您要执行的操作称为“深层链接”。 This means clicking on a links opens your app and redirects the user to a specific page depending on the link. 这意味着单击链接将打开您的应用程序,并根据链接将用户重定向到特定页面。

This is possible with Ionic and the DeepLink native plugin . 使用Ionic和DeepLink本机插件可以做到这一点。

But there need to be done other things outside your app to make it work. 但是需要在您的应用之外进行其他操作才能使其正常运行。 You need to register and verify your domain with Google and/or Apple. 您需要在Google和/或Apple上注册并验证您的域。

And be aware testing this is very uncomfortable. 并且请注意测试这是非常不舒服的。 It will only work with signed packes. 它仅适用于签名包。 So just running ionic cordova run android won't work, you will have to go the whole way creating a signed package as you need to do when you're going to publish it. 因此,仅运行ionic cordova run android将无法正常工作,您将必须按照需要在创建要发布的程序包时全程进行操作。

Here is a Blog article describing the functionality. 这是描述功能的博客文章

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

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