简体   繁体   English

Salesforce Android应用中的自定义URL方案

[英]Custom url scheme in salesforce android app

I am looking to implement a custom url scheme (eg myapp://) so that my android app can be opened on the browser and/or from an email link. 我正在寻求实现自定义网址方案(例如myapp://),以便可以在浏览器中和/或从电子邮件链接中打开我的android应用。 I understand that there are a lot of answers here that point to intent filters in the AndroidManifest.xml as the answer, but I have not been able to get it to work. 我知道这里有很多答案,这些答案都指向AndroidManifest.xml中的意图过滤器作为答案,但是我无法使其工作。 I am not sure how to get my app to detect those intent filters. 我不确定如何让我的应用检测这些意图过滤器。 If someone can help me on this, that would be great. 如果有人可以帮助我,那就太好了。

Thank you. 谢谢。

Try a tutorial like this one: http://www.vogella.com/articles/AndroidIntent/article.html#intentfilter in the part where it says <data android:scheme="http"/> set it to <data android:scheme="myapp"/> 尝试类似这样的教程: http : //www.vogella.com/articles/AndroidIntent/article.html#intentfilter在其中将<data android:scheme="http"/>设置为<data android:scheme="myapp"/>

Then in the Activity you put this IntentFilter in, just go ahead and do a getIntent().getData() and that will give you the URI. 然后在“活动”中放入此IntentFilter,继续进行getIntent().getData() ,这将为您提供URI。 Then you can process as you like. 然后,您可以根据需要进行处理。 For example if you send myapp://opencontact/joe_bob you can pull out the parts and open your ContactProfileActivity or whatever and show the user Joe Bob... 例如,如果您发送myapp://opencontact/joe_bob ,则可以拉出零件并打开ContactProfileActivity或其他任何内容,并向用户显示Joe Bob ...

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

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