Android App

You can create HTML5 mini-games using Studio, activate the game, and view the URL link to run the game. To add the completed mini-game to an Android app, the app must support Webview.

The following content is an example of coding to load and execute the URL in an Android WebView, assuming you are creating a mini-game in Studio and the execution link is https://branded.mini-games.io/?php=landing@UserID_Data&campaign_no=0123456.


To load a specific URL in a WebView on an Android app, you can follow these steps:

  1. Add WebView to your layout file (XML):

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>
  1. Enable Internet permission in the AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
  1. In your activity file, set up and load the WebView:

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView webView = findViewById(R.id.webview);
        webView.setWebViewClient(new WebViewClient()); // Ensures links open within the WebView
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true); // Enable JavaScript if necessary

        String url = "https://branded.mini-games.io/?php=landing@UserID_Data&campaign_no=0123456";
        webView.loadUrl(url); // Load the specified URL
    }
}

This code will enable WebView in your Android app and load the specified URL, displaying it within the WebView component.

Last updated