how to forward error page in xamarin webview

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



how to forward error page in xamarin webview



Could somebody please provide an example of how to check xamarin webview android apps I already checking before run apps if no internet web page and toast message are showing no Internet. But the user is before run apps using wifi/mobile data so my apps are not issuing, the problem is after run apps they close wifi/mobile data or turn on airplane mode so my apps are showing "webpage not available" The webpage at http://www.example.com/login.aspx could not be loaded because:
net::ERR_INTERNET_DISCONNECTED.



I don't want to show my URL to the customer. So how can I check after run apps and user is turn off the internet?


public class MainActivity : AppCompatActivity

WebView web_view;
protected override void OnCreate(Bundle savedInstanceState)

base.OnCreate(savedInstanceState);

// Set our view from the "main" layout resource
SetContentView(Resource.Layout.content_main);
ConnectivityManager connectivityManager = (ConnectivityManager)GetSystemService(Activity.ConnectivityService);
NetworkInfo networkInfo = connectivityManager.ActiveNetworkInfo;
web_view = FindViewById<WebView>(Resource.Id.webView1);
bool isActive = networkInfo != null && networkInfo.IsAvailable && networkInfo.IsConnected;

if (isActive)

if (networkInfo.IsConnected)

web_view.Settings.JavaScriptEnabled = true;
web_view.LoadUrl("http://www.example.com/login.aspx");
web_view.SetWebViewClient(new WebViewClient());
web_view.Settings.SetSupportZoom(true);
web_view.RestoreState(savedInstanceState);

else

string summ = "<html><body><font color='red'>No Internet Connection NetWork Not Available Please Check Your internet Connectivity</font></body></html>";
web_view.LoadData(summ, "text/html; charset=UTF-8", null);
Toast.MakeText(this, "No Internet Connection Please Check Your Internet Connectivity", ToastLength.Long).Show();


else

string summ = "<html><body><font color='red'>No Internet Connection NetWork Not Available Please Check Your internet Connectivity</font></body></html>";
web_view.LoadData(summ, "text/html; charset=UTF-8", null);
Toast.MakeText(this, "No Internet Connection Please Check Your Internet Connectivity", ToastLength.Long).Show();








I don't know xmarin, but If you can change java code, you should check out this stackoverflow.com/a/17959683/7131770
– AwesomeGeek
Aug 14 at 6:33










By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS