[英]Handling a deep link from the google assistant in Java
Looking to handle a deep link from the Google Assistant.希望处理来自 Google 助理的深层链接。 As I only have an emulator at the moment I am having trouble testing it (from what I have read it requires a real device).
因为我目前只有一个模拟器,所以我在测试它时遇到了麻烦(从我读到的内容来看,它需要一个真实的设备)。 That said, I was wondering if I am handling it the correct way.
也就是说,我想知道我是否以正确的方式处理它。 I am unfamiliar with Kotlin and my code was turning into Spaghetti trying to integrate, so I put this together in my existing launcher activity just to try and get it bootstrapped for now.
我不熟悉 Kotlin 并且我的代码正在变成意大利面试图集成,所以我把它放在我现有的启动器活动中只是为了尝试让它现在引导。 The manifest and actions.xml were set up like the fitness app tutorial.
manifest 和 actions.xml 的设置就像健身应用教程一样。
Am I doing this correctly?我这样做正确吗?
if (mAuth.getCurrentUser() != null) {
data = this.getIntent().getData();
if (data != null && data.isHierarchical()) {
uriData = data.toString();
containsStart = containsIgnoreCase(uriData,"start");
containsRun = containsIgnoreCase(uriData,"run");
if(containsStart && containsRun) {
Intent intent = new Intent(getApplication(), RunActivity.class);
intent.putExtra("runStart", true);
startActivity(intent);
}
}
else {
checkUserAccType();
}
//Else, if there is no current user, start the Authentication activity
}
A few observations and recommendation about your code:关于您的代码的一些观察和建议:
containsIgnoreCase
uses getPath()
and match the path.containsIgnoreCase
使用getPath()
并匹配路径。 See example . containsIgnoreCase
.containsIgnoreCase
。 See example startActivity
and checkUserAccType
will handle that part.startActivity
和checkUserAccType
将处理那部分。 See example . getCurrent
method signature.getCurrent
方法签名使用 Firebase。 See example
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.