我输入了一个字符串URI.怎么可能得到最后一个路径段?在我的情况下是一个id?
这是我输入的网址
String uri = "http://base_path/some_segment/id"
Run Code Online (Sandbox Code Playgroud)
而且我必须获得我尝试过的这个ID
String strId = "http://base_path/some_segment/id";
strId=strId.replace(path);
strId=strId.replaceAll("/", "");
Integer id = new Integer(strId);
return id.intValue();
Run Code Online (Sandbox Code Playgroud)
但它不起作用,肯定有更好的方法来做到这一点.
我正在为开源会议撰写应用程序.
最初每位与会者将通过电子邮件或短信等方式收到不同的链接
https://example.com/?token=fccfc8bfa07643a1ca8015cbe74f5f17
然后使用此链接打开应用程序,我们可以通过令牌知道用户是哪个与会者.
Firebase在I/O 2016中发布了一项新功能动态链接,它为用户提供了更好的体验.
我试过了,但我找不到任何方法来传递动态链接中的自定义参数(令牌),如何使用不同参数的相同链接给我的用户?
谢谢.
我手动创建了动态链接,并在链接上设置了一些额外的参数,如下所示:https://XXXXX.goo.gl/? link = http%%3A%2F%2Fairbanq.send.com%2Fsendmoney&apn=com.xxxx. XXXX&AMV = 1&用户名= Adri&量= 7.00
但是当应用程序打开时,我得到:"https:// airbanq.send.com/sendmoney"没有附加参数
我正在使用此示例代码 https://github.com/firebase/quickstart-android/tree/master/dynamiclinks
请帮忙,
谢谢
我的代码
public String buildDeepLink() {
// Get the unique appcode for this app.
String appCode = AirBanqApp.mContext.getString(R.string.app_code);
// Get this app's package name.
String packageName = AirBanqApp.mContext.getPackageName();
// Build the link with all required parameters
Uri.Builder builder = new Uri.Builder()
.scheme("https")
.authority(appCode + ".app.goo.gl")
.path("/")
.appendQueryParameter("link", deepLink)
.appendQueryParameter("apn", packageName);
// If the deep link is used in an advertisement, this value must …Run Code Online (Sandbox Code Playgroud) 我创建了动态链接,我想发送一些特定的参数,例如:“ https://mydynamiclink/?link= ” + 链接 + “&msgid=” + id + “&apn=myapn”。
link字段看起来像“ https://play.google.com/store/apps/details/?id=com.myApp&msgid=myId&apn=myapn ”
当我点击此链接后打开我的应用程序时 - 我收到PendingDynamicLinkData并可以从中获取链接,但不能获取一些自定义数据。(pendingDynamicLinkData.getLink()返回没有“&msgid=...”的链接 - 我得到字符串“ https://play.google.com/store/apps/details/?id=com.myApp ”)
我怎样才能添加我的 msgid 字段并获取它呢?