In app WebView. Web viewer android studio

in app webview

In app webview is an in-app site. It is used by arbitrageurs to drain on gambling, day betting, cryptocurrency, commodities and other verticals. Now let’s create a simple WebView application for traffic arbitrage.

In app WebView. Installing and configuring Android Studio

Download Android Studio from the official website developer.android.com/studio. Install the program on your computer. Leave all the default settings.

After installing, launch Android Studio. The program asks you to install the Android SDK. At this stage, choose the path in English.

Installing and configuring Android Studio

If we choose a path that has letters other than English, the program will show an error.

Select the path, press “Next”. Then press “Finish”. This will start installing the Android SDK on your computer.

After installing the Android SDK, on the start page of the program click on Configure. Select the SDK Manager.

Select the SDK Manager.

In the menu that opens, go to the Android SDK tab (Appearance & Behavior → System Settings).

Uncheck Android 11.0 (R)

Uncheck Android 11.0 (R). Check Android 10.0 (Q). Go to the tab SDK Tools.

Android Emulator, Android SDK Platform-Tools, Intel x86 Emulator Accelerator

Check the following items: Android Emulator, Android SDK Platform-Tools, Intel x86 Emulator Accelerator (HAXM installer). Click Apply.

Click Ok and accept the user agreement for each package.

During the download, a window may open where you need to allocate the maximum amount of RAM to run the emulators.

maximum amount of RAM to run the emulators

Specify and click Next.

Now let’s write the environment variable on the computer and in Android Studio. To do this, right-click on “My Computer”. Select “Properties”.

Click on “Advanced System Settings” and select “Environment Variables”.

In the “User Environment Variables for User” field, click “Create”.
Specify the name of the variable ANDROID_SDK_ROOT and the value of the variable (example: D:\your folder\AndroidStudioSDK). Press OK.

Let’s create another variable. Specify the variable name ANDROID_SDK_HOME and the path (example: D:\your folder\ AndroidStudioProjects).

Go back to Android Studio. Click on Configure and open Settings.

Click on Configure and open Settings

Go to the tab Path Variables.

Go to the tab Path Variables.

Create environment variables by clicking on the plus sign.

ANDROID_SDK_ROOT

Specify the variable name ANDROID_SDK_ROOT and the variable value (example: D:\your folder\AndroidStudioSDK). Press OK.

Let’s create another variable. Specify the variable name ANDROID_SDK_HOME and the path (example: D:\your folder\ AndroidStudioProjects).

Press Apply and OK.

Now let’s create a virtual machine. To do this, click on Configure and open the AVD Manager.

AVD Manager

Click Create Virtual Device.

Click Create Virtual Device.

The program is ready to work. Let’s move on to creating the first WebView application.

Creating a WebView application. Web viewer android studio

Open the start page of the program. Let’s create a new project. To do this, click on Create New Project.

Choose the standard template Empty Activity.

template Empty Activity

Click Next.

Name the project. Choose the programming language Java and the Minimum SDK (the minimum version of Android, which will support the application).

Press Finish.

Press Finish.

Go to the manifest folder and open the file AndroidManifest.xml.

AndroidManifest.xml.

Prescribe permissions for access to the Internet.

Before application we write the code:

<uses-permission android:name="android.permission.INTERNET"/>

Go to res → layout. Open the file activity_main.xml.

If there is no code, click Split in the upper right corner.

Remove the standard code text.

Remove the standard code text.

Insert the following code in its place:

<WebView
    android:id="@+id/webView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />

Find the MainActivity file in the java folder.

Insert the code inside the @Override method brackets:

WebView webView = findViewById(R.id.webView);

webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://webtraffic.guru/");

WebViewClient webViewClient = new WebViewClient() {
    @SuppressWarnings("deprecation") @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        return true;
    }

    @TargetApi(Build.VERSION_CODES.N) @Override
    public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
        view.loadUrl(request.getUrl().toString());
        return true;
    }

};
webView.setWebViewClient(webViewClient); 

In the webView.loadUrl variable, insert the URL that will be opened in the application. For example,

ebView.loadUrl("https://webtraffic.guru/");
webView.loadUrl(httpswebtraffic.guru);

Open the file AndroidManifest.xml. At the end of the tag application write the following code:

android:configChanges="orientation|keyboardHidden|screenSize"

It is needed so that when you rotate the screen the application is not updated.

If automatic import of classes is disabled, we do everything manually. Find the code fragments highlighted in red, move the cursor and click Import class in the table that pops up.

All the created applications have standard icons by default. To change them, right-click on the folder Res, select New and go to Image Asset.

select New and go to Image Asset

In the Path column, click on the folder icon. Find the file you want to use as the application icon.

application icon

Click Next and Finish.

Now let’s see if the application works. Launch the emulator.

Now let's see if the application works. Launch the emulator.

If all is well, the application will start.

app https://webtraffic.guru/

The simple WebView application is ready. Now let’s create an APK file.

In the menu click on Build and select Generate Signed Bundle/APK…

In the menu click on Build and select Generate Signed BundleAPK

Select the APK and click Next.

Create new in the Key store path field

Create new in the Key store path fieldSince this is the first time we are creating an application, we need to create a key store file to sign the application. To do this, select Create new in the Key store path field.

Key store path field

In the menu that opens, in the Key store path field, click on the folder on the right. Come up with a name. Next, specify the passwords.

Below fill in the name, surname, company name, organization, city, region, country code in the format XX.

Click on OK and Next.

In the Destination Folder field enter the path to save the APK-file. Below select release and check both checkboxes below.

APK file is ready

Press Finish.

Wait a few minutes. A notification will appear in the program that the APK file is ready.

The simple WebView application is ready to work.

Don`t copy text!