I am working with web application (iOS/Android)
Basically, My application looks like
what I trying to do is detecting request from user is form Mobile Application or mobile browser.(with javascript)
Is it even possible? If yes, recommend the method(I prefer native javascript since project is commercial)
Thanks.
P.S. I do not need device detect with navigator.userAgent
, purpose of this job is detecting mobile browser or mobile app, not which device user uses.
You can add a custom user agent string for your application webview so that you can distinguish a webview from js For android you can use
myWebView.getSettings().setUserAgentString(<your custom user agent string>);
It is better to append extra string to the actual useragent string
myWebView.getSettings.getSettings().setUserAgentString(myWebView.getSettings().getUserAgentString() + <your custom user agent string>);
You can check whether the user agent string contains the custom extra string from JavaScript.