From 98b63cc37e49466acc9b6b7f027c073fa5313e97 Mon Sep 17 00:00:00 2001 From: Connor Pearson Date: Fri, 13 Mar 2015 14:12:40 -0400 Subject: [PATCH] CB-3360: Set custom inappbrowser user agent for android github close #95 --- src/android/InAppBrowser.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index b9da5d7..3a4a6a4 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -673,6 +673,16 @@ public class InAppBrowser extends CordovaPlugin { settings.setMediaPlaybackRequiresUserGesture(mediaPlaybackRequiresUserGesture); } + String overrideUserAgent = preferences.getString("OverrideUserAgent", null); + String appendUserAgent = preferences.getString("AppendUserAgent", null); + + if (overrideUserAgent != null) { + settings.setUserAgentString(overrideUserAgent); + } + if (appendUserAgent != null) { + settings.setUserAgentString(settings.getUserAgentString() + appendUserAgent); + } + //Toggle whether this is enabled or not! Bundle appSettings = cordova.getActivity().getIntent().getExtras(); boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled", true);