Denied starting an intent without a user gesture
来源:互联网 发布:sqlserver 索引维护 编辑:程序博客网 时间:2024/06/10 08:14
前端 写了个 网页替换replace 方法。发现在Android 7.0系统不执行,而Android 5.1 系统上却可以正常运行。webview并没有做复杂的功能只是有俩个js交互的方法。
看到log日志中 一直在输出: W/cr_AwContentsClient: Denied starting an intent without a user gesture, URI http://网址.html。
意图被拒绝。
先说解决办法:webview添加这句话即可。
webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return false; }});
是什么导致这个问题的呢:
From newest androids, the WebView and Chrome Client is separated application which can be automatically updated without user intention.
From Chrome x >= 25 version, they changed how loading url is working in android application which is using webview component. https://developer.chrome.com/multidevice/android/intentsLooks like they are blocking changing url without user gesture and launched from JavaScript timers
Solution here is to force user to activate URL change, for example on button click.
Also, you can override method mentioned above "shouldOverrideUrlLoading" in WebView client.
大概意思就是 Chrome 版本>=25的时候,意图对象就被拒绝了。解决办法就是:强制启动一个URL 或者在 安卓客户端重写shouldOverrideUrlLoading 这个方法。
假如安卓端不方便更新应用了,有没有办法解决呢?答案是肯定的, 我们点进去上面的网址(需要科学上网),发现官方给出的办法:
1、The best practice is to construct an intent anchor and embed that into the page so the user can launch the app. This gives you a lot more flexibility in controlling how apps are launched, including the ability to pass extra information into the app via Intent Extras.
2、Also, you may choose to specify fallback URL by adding the following string extra:
S.browser_fallback_url=[encoded_full_url]
When an intent could not be resolved, or an external application could not be launched, then the user will be redirected to the fallback URL if it was given.
一起学习Android的朋友,请联系我springlovvol@163.com
- denied starting an intent without a user gesture
- Denied starting an intent without a user gesture
- Develop a web service without an IDE
- Android之Starting an Activity for a Result例子简介
- Android之Starting an Activity for a Result例子简介
- android-Building a Notification,Preserving Navigation when Starting an Activity
- activity能被其他的AP启动的条件 or android permission denied : starting Intent
- activity能被其他的AP启动的条件 or android permission denied : starting Intent
- How to encrypt a string/stream with bouncycastle pgp without starting with a file
- mysql/mariadb root user get ERROR 1045 (28000): Access denied without sudo
- Crashlytics was applied to a project without an Android plugin.
- Starting an Activity
- 05Starting an Activity
- Starting an Activity
- Starting an Activity
- Identifying the Intent of a User Query Using SVM
- creates a new user for an ASP.NET application
- Calling a method in the system process without a qualified user
- c语言(结构体)---实现学生信息输入,输出,查询
- qRegisterMetaType的使用
- 盘点HR日常工作数据计算大全
- 用什么打开DWG文件进行查看呢
- 11.10 JavaScript基础2
- Denied starting an intent without a user gesture
- 使用Feign实现声明式Restful风格调用
- web环境安装相关
- 网络字节顺序NBO(Network Byte Order)和主机字节顺序(HBO,Host Byte Order)转换
- 遇到的浏览器兼容问题
- Mac 安装 talib
- Tomcat7.0.42源码研读之Session管理(八)
- Object.keys() 获取对象的length
- Java基础——类加载机制及原理