I want to load one url into my webview, Its a Casino game. But when i open the app it show "Please Rotate Your Device" in a black screen.
How i can check that message programmatically and set the screen orientation landscape instead of user rotating their device ?
My MainActivity Code :
package com.mob.wunderin.oapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebSettings;
import android.content.pm.ActivityInfo;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
WebView webView = findViewById(R.id.myWebview);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("http://deuceswildcards.site/wildcards.php?app=fun&Gtype=poker#/main");
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mob.wunderin.oapp">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The Output :
Please help me to check the "Rotate your device" message and set the screen orientation to landscape programatically ?