webview - Android development adding custom string to useragent -
i'm trying add custom http header webview of android application validate if webview running our app.
when use webview.getsettings shows error message time.
android.webkit.webview not contain defenition getsettings()
this our code:
using android.app; using android.os; using android.webkit; using android.widget; using android.views; namespace loadwebpage { [activity(label = "loadwebpage", mainlauncher = true, icon = "@drawable/icon")] public class activity1 : activity { protected override void oncreate (bundle bundle) { base.oncreate (bundle); setcontentview (resource.layout.main); webview webview = findviewbyid<webview>(resource.id.localwebview); webview.setwebviewclient (new webviewclient ()); websettings settings = webview.getsettings(); webview.settings.javascriptenabled = true; webview.loadurl("http://www.google.nl"); webview.settings.builtinzoomcontrols = false; webview.settings.setsupportzoom(true); window.addflags(windowmanagerflags.fullscreen); window.clearflags(windowmanagerflags.forcenotfullscreen); }; } } }
thanks.
this solution fixed our problem.
string standard_agent = webview.settings.useragentstring; webview.settings.useragentstring = standard_agent + "newuseragent";
Comments
Post a Comment