2

I have Webview in my app.Recently i tried to login in gmail but got Error "Error 403:disallowed_useragent".

From Documentation I used

Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36 

But my app crash

 E/chromium: [ERROR:validation_errors.cc(76)] Invalid message: VALIDATION_ERROR_DESERIALIZATION_FAILED (safe_browsing.mojom.SafeBrowsing.0 ) E/chromium: [ERROR:render_process_host_impl.cc(4990)] Terminating render process for bad Mojo message: Received bad user message: Validation failed for safe_browsing.mojom.SafeBrowsing.0 [VALIDATION_ERROR_DESERIALIZATION_FAILED (safe_browsing.mojom.SafeBrowsing.0 )] [ERROR:bad_message.cc(27)] Terminating renderer for bad IPC message, reason 123 E/chromium: [ERROR:validation_errors.cc(76)] Invalid message: VALIDATION_ERROR_DESERIALIZATION_FAILED (network.mojom.URLLoaderFactory.0 ) E/chromium: [ERROR:render_process_host_impl.cc(4990)] Terminating render process for bad Mojo message: Received bad user message: Validation failed for network.mojom.URLLoaderFactory.0 [VALIDATION_ERROR_DESERIALIZATION_FAILED (network.mojom.URLLoaderFactory.0 )] [ERROR:bad_message.cc(27)] Terminating renderer for bad IPC message, reason 123 E/chromium: [ERROR:aw_browser_terminator.cc(125)] Renderer process (14677) crash detected (code -1). E/chromium: [ERROR:aw_browser_terminator.cc(90)] Render process (14677) kill (OOM or update) wasn't handed by all associated webviews, killing application. 

So I like to know How to construct a user agent string which i can use for every site.I will be more thank full if someone tells me the importance of user agent.

1 Answer 1

0

See android user agent. For old versions of Android (API < 30) use:

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

User-agent tells the site what browser has a user. Depending on this value the site can change a behaviour (can load different contents or JavaScript), also it is used in analytics.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.