Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Jatin-Mehra119/PDF-Insight-Beta/llms.txt

Use this file to discover all available pages before exploring further.

The PDF Insight Pro Android app is a lightweight native Java client that wraps the deployed web application in a full-screen WebView. Rather than duplicating API logic on mobile, the app simply loads the live URL of your Hugging Face Spaces deployment (or any publicly accessible instance) and presents it with a native splash screen, hardware back-button navigation, file-upload support, and a download manager — giving mobile users the complete feature set without a separate codebase to maintain.

Architecture

The app is composed of two Activity classes that chain together in sequence.

SplashActivity

The launcher activity. It displays the app branding in full-screen portrait mode, sleeps for 3 000 ms on a background thread, fires an Intent to start MainActivity, then calls finish() so the splash screen is removed from the back stack.

MainActivity

Hosts the WebView. On creation it checks network availability via the CheckNetwork helper class; if no connection is found it shows an AlertDialog and exits. When a connection is present it configures the WebView settings and loads the target URL.

Activity chain

App launch
    └─▶ SplashActivity  (full-screen, 3 s delay)
            └─▶ Intent → MainActivity
                            └─▶ WebView loads https://jatinmehra-pdf-insight-pro.hf.space
SplashActivity is declared as the MAIN / LAUNCHER activity in the manifest, so it is always the entry point. MainActivity is declared with android:exported="false" — it can only be started from within the app.

WebView Configuration

MainActivity applies the following settings to the WebView instance before loading the URL:
String websiteURL = "https://jatinmehra-pdf-insight-pro.hf.space";
private WebView webview;

// Inside onCreate(), after confirming network availability:
webview = findViewById(R.id.webView);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
webview.loadUrl(websiteURL);
webview.setWebViewClient(new WebViewClientDemo());
webview.setWebChromeClient(new WebChromeClientDemo());
SettingValuePurpose
setJavaScriptEnabledtrueRequired for the FastAPI static frontend (uses app.js)
setDomStorageEnabledtrueEnables localStorage / sessionStorage used by the chat UI
setOverScrollModeOVER_SCROLL_NEVERRemoves the rubber-band bounce effect for a cleaner feel
WebViewClientDemocustom subclassIntercepts URL changes and loads them inside the WebView rather than opening the system browser
WebChromeClientDemocustom subclassImplements onShowFileChooser so users can pick a PDF from device storage for upload

File upload support

WebChromeClientDemo overrides onShowFileChooser to bridge the HTML <input type="file"> element to Android’s file picker:
private class WebChromeClientDemo extends WebChromeClient {
    @Override
    public boolean onShowFileChooser(WebView webView,
                                     ValueCallback<Uri[]> filePathCallback,
                                     FileChooserParams fileChooserParams) {
        if (MainActivity.this.filePathCallback != null) {
            MainActivity.this.filePathCallback.onReceiveValue(null);
        }
        MainActivity.this.filePathCallback = filePathCallback;

        Intent intent = fileChooserParams.createIntent();
        try {
            fileChooserLauncher.launch(intent);
        } catch (Exception e) {
            MainActivity.this.filePathCallback = null;
            Toast.makeText(MainActivity.this,
                    "File upload failed: " + e.getMessage(),
                    Toast.LENGTH_SHORT).show();
            return false;
        }
        return true;
    }
}
The result is delivered back to the page via filePathCallback.onReceiveValue(results) in the ActivityResultLauncher registered at activity creation.

Back-button navigation

onBackPressed checks whether the WebView has a back history. If so it navigates back inside the web app; if not, it shows a confirmation dialog before exiting:
@Override
public void onBackPressed() {
    if (webview.isFocused() && webview.canGoBack()) {
        webview.goBack();
    } else {
        new AlertDialog.Builder(this)
                .setTitle("EXIT")
                .setMessage("You want to close this app?")
                .setPositiveButton("Yes", (dialog, which) -> finish())
                .setNegativeButton("No", null)
                .show();
    }
}

Building the APK

1

Open the project in Android Studio

Launch Android Studio and choose Open, then select the Android App/ subdirectory of the repository (the directory that contains app/ and the root build.gradle). Allow Gradle to sync — it will download all dependencies automatically.
2

Update the target URL

Open Android App/app/src/main/java/com/jatinmehra/pdfinsightpro/MainActivity.java and replace the default URL with your own deployment:
// Before
String websiteURL = "https://jatinmehra-pdf-insight-pro.hf.space";

// After — point to your own Hugging Face Space or custom domain
String websiteURL = "https://<your-hf-username>-<your-space-name>.hf.space";
Save the file.
3

Build a release APK

From the terminal inside the Android App/ directory:
./gradlew assembleRelease
Or in Android Studio: Build → Generate Signed Bundle / APK → APK → Release.
4

Locate the output APK

The unsigned release APK is written to:
Android App/app/build/outputs/apk/release/app-release-unsigned.apk
If you use Android Studio’s signed APK wizard the signed APK will be placed in Android App/app/release/.

Permissions

The following permissions are declared in AndroidManifest.xml:
PermissionRequiredPurpose
android.permission.INTERNETYesAllows the WebView to make HTTP/HTTPS requests to the deployed server
android.permission.ACCESS_NETWORK_STATEYesUsed by CheckNetwork.isInternetAvailable() to detect connectivity before loading
android.permission.WRITE_EXTERNAL_STORAGERuntime (API ≥ 23)Requested at runtime on Android 6.0+ to save downloads via the DownloadManager

Minimum SDK

Extracted from app/build.gradle:
PropertyValue
minSdk24 (Android 7.0 Nougat)
targetSdk34 (Android 14)
compileSdk34
versionName1.2.0
The Android app is a remote client — it has no embedded backend. The server must be publicly reachable on the internet before the app can function. When testing on a physical device, localhost or 10.0.2.2 will not work; you must deploy to Hugging Face Spaces (or another public host) and point websiteURL at that address.
Before distributing the app on the Google Play Store you must sign the APK (or AAB) with a release keystore. Use Android Studio’s Generate Signed Bundle / APK wizard or the jarsigner / apksigner CLI tools. Keep your keystore file and passwords in a secure location — you cannot update a Play Store app with a different signing key.

Build docs developers (and LLMs) love