Support for Universal Android WebView App

Support for Universal Android WebView App

Cart 3,518 sales

Popular questions for this item

Are you going to support Eclipse IDE?

We are not. Android Studio is the future. Eclipse IDE is deprecated for Android development. It does not support Gradle which we use for managing and building apps. Android Studio is a new Android development environment based on IntelliJ IDEA. It provides new features and improvements over Eclipse ADT and is the official Android IDE. Android Studio is much more powerful and easier to use. There is no reason to use Eclipse anymore.

I get error “You need to use a different version code for your APK because you already have one with version code XYZ” when uploading to Google Play. How can I fix it?

If you are releasing a new update in Google Play, you have to increment the version code. Open mobile/build.gradle file and try to increment VERSION_PATCH value. Version code is calculated this way: VERSION_MAJOR*10000000 + VERSION_MINOR*100000 + VERSION_PATCH*1000 + VERSION_BUILD. If it does not help, try to increment another version constant.

How to show information about use of cookies and other forms of local storage?

European laws require that digital publishers give users information about their use of cookies and other forms of local storage. In many cases these laws also require that consent be obtained. See for more info.

Open in activity package. Find onStart() method and add following piece of code at the end of the method: showCookiesDialog();
Finally add following code somewhere inside the MainActivity object: private void showCookiesDialog() { final String FIRST_RUN = "first_run"; final SharedPreferences preferences = getSharedPreferences("cookies", MODE_PRIVATE); if(preferences.getBoolean(FIRST_RUN, true)) { new AlertDialog.Builder(this) .setTitle("Cookies") .setMessage("We use device identifiers to personalise content and ads, to provide social media features and to analyse our traffic. We also share such identifiers and other information from your device with our social media, advertising and analytics partners.\n\nBy using our services, you agree to our use of device identifiers.") .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { preferences.edit().putBoolean(FIRST_RUN, false).commit(); } }).show(); } }

How can I add another buttons to the action bar menu?

You can modify menu in the action bar editing res/menu/fragment_main.xml file. Then you have to invoke some action if the menu button is pressed. You can do that in onOptionsItemSelected() method inside See this article for more info:

How can I enable zoom controls in the webview?

Open in fragment package. Find setupView() method and replace “mWebView.getSettings().setBuiltInZoomControls(false);” by “mWebView.getSettings().setBuiltInZoomControls(true);”.

If you want to hide zoom buttons, add this piece of code below: mWebView.getSettings().setDisplayZoomControls(false);

How can I set web page scale? The website is too big so users have to zoom out.

Open in fragment package. Find setupView() method and add following piece of code at the end of the method (argument is the scale in percent): mWebView.setInitialScale(50); or you can also try this code: mWebView.getSettings().setUseWideViewPort(true); mWebView.getSettings().setLoadWithOverviewMode(true);

How should I handle Facebook login? Blank page is shown after signing in.

Open in fragment package. Find onPageFinished method and add following piece of code under this line “showActionBarProgress(false);”: if(url.contains("") && url.contains("dialog/oauth") && (url.contains("&refsrc") || url.contains("&domain"))) { Uri uri = Uri.parse(url); String callbackUrl = uri.getQueryParameter("refsrc"); if(callbackUrl==null) callbackUrl = "http://" + uri.getQueryParameter("domain"); view.loadUrl(callbackUrl); // callback URL }

How can I force RTL (right to left) mode?

RTL (right to left) was introduced in Android 4.2. See Native RTL support in Android 4.2 for more info.

If you need to force your entire layout to be RTL including the action bar, open in activity package. Find onCreate method and add following piece of code at the end of the method: if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL); }

Show more


Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey