Sometimes we have an app with webview in android where we use our website as app in android. Where to hold website we use android webview. To identify or detect the app in php websites we need to solve the situation. To do this php provides a predefined variable :
$_SERVER['HTTP_X_REQUESTED_WITH']
This variable matches the package name of android app to identify if user is using our android app or using website.
Example is given below :
if($_SERVER['HTTP_X_REQUESTED_WITH'] == "com.sk.codes") {
echo 'Welcome to Basic Codes android app.';
}
0 Comments:
Post a Comment