[英]Can Google App Indexing work with special characters in the url? (acutes áéó..)
I'm trying to implement google app indexing into my apps.我正在尝试在我的应用程序中实现谷歌应用程序索引。 It works perfectly with almost all my sections but it fails with a section of my app which name is:
Sección con acentos áéó
它几乎适用于我的所有部分,但它在我的应用程序的一部分中失败,名称为:
Sección con acentos áéó
I add this into my html web for testing the deep linking:我将此添加到我的 html web 中以测试深层链接:
<a href="android-app://com.example.launcher/http/section/Sección con acentos áéó">Sección con acentos áéó</a>
When I press the link on the html, my app is being successfully opened but the intent filter is not being called correctly because I can't receive the data body with "Sección con acentos áéó"当我按下 html 上的链接时,我的应用程序已成功打开,但未正确调用意图过滤器,因为我无法接收带有“Sección con acentos áéó”的数据体
I tryed using a URL Encoded link with Secci%C3%B3n%20con%20acentos%20%C3%A1%C3%A9%C3%B3
but same problem我尝试使用带有
Secci%C3%B3n%20con%20acentos%20%C3%A1%C3%A9%C3%B3
的 URL 编码链接,但同样的问题
Google App Indexing deep linking has limitations with special characters? Google App Indexing 深层链接对特殊字符有限制吗?
Google App Indexing deep linking has limitations with special characters?
Google App Indexing 深层链接对特殊字符有限制吗?
No, it doesn't have any limitation with special characters.不,它对特殊字符没有任何限制。
I tried with both your URL and also with the URL generated by the official Test Your App Indexing Implementation page :我尝试使用您的网址以及官方测试您的应用索引实施页面生成的网址:
android-app://com.example.launcher/http/section/Sección con acentos áéó
android-app://com.example.launcher/http/section/Secci%C3%B3n%20con%20acentos%20%C3%A1%C3%A9%C3%B3
intent://section/Secci%C3%B3n con acentos %C3%A1%C3%A9%C3%B3#Intent;scheme=http;package=com.example.launcher;end
Every URL successfully opens the app and the data
contained in the intent is:每个 URL 都成功打开应用程序,并且 Intent 中包含的
data
是:
http://section/Secci%C3%B3n%20con%20acentos%20%C3%A1%C3%A9%C3%B3
Once received the intent you need to use URLDecoder.decode
to decode the URL:收到意图后,您需要使用
URLDecoder.decode
来解码 URL:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = getIntent();
if (intent != null) {
Uri data = intent.getData();
if (data != null) {
String uri = data.toString();
Log.d(TAG, "URI: " + uri);
String decodedUri = null;
try {
decodedUri = URLDecoder.decode(uri, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Log.d(TAG, "DECODED URI: " + decodedUri);
}
}
}
This is the obtained result:这是得到的结果:
com.example.launcher D/MainActivity: URI: http://section/Secci%C3%B3n%20con%20acentos%20%C3%A1%C3%A9%C3%B3
com.example.launcher D/MainActivity: DECODED URI: http://section/Sección con acentos áéó
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.