Android的用户代理 [英] android user agent

查看:292
本文介绍了Android的用户代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写在Android中使用一个web视图来显示HTML内容的应用程序。有人告诉我,让我的应用程序在Android用户代理 - 我该怎么办呢?我打开 http://whatsmyuseragent.com 从我的应用程序和Android浏览器 - 无论是用户代理是相同的。

I am writing an app in Android that uses a WebView to display HTML content. I was told to get an Android user agent for my app - how do I do that? I opened http://whatsmyuseragent.com from my app as well as the Android browser - both the user agents are the same.

请帮忙!

推荐答案

经过反复研究,我理解了它。有一种方法来设置为Android的WebView用户代理。

After much research, I figured it out. There is a way to set a user agent for Android WebView.

webview.getSettings().setUserAgentString("user-agent-string");

<一个href="http://developer.android.com/reference/android/webkit/WebSettings.html">http://developer.android.com/reference/android/webkit/WebSettings.html

这篇关于Android的用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆