Offerwall SDK Integration

Integrate the AdPortHub Offerwall into your app using a SDK to display dynamic offers and engage users seamlessly.

Integration Steps =>

  1. Obtain API Key and User ID:

  • Log in to your AdPortHub account and retrieve your API_KEY and USER_ID.

  1. Update build.gradle:

  • Add WebView dependency if needed. Ensure your build.gradle includes

Gradle
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.webkit:webkit:1.7.0' // Optional
  1. Modify AndroidManifest.xml:

    • Ensure internet permission is granted:

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

    • Implement the AdPortHub sdk:

MainActivity Example:
package com.example.yourapp;

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

public class MainActivity extends AppCompatActivity {
    private WebView webView;

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

        webView = findViewById(R.id.webView);
        webView.getSettings().setJavaScriptEnabled(true); // Enable JavaScript if needed

        // Replace with your actual API key and user ID
        String apiKey = "your_api_key";
        String userId = "your_user_id";
        String url = "https://dashboard.adporthub.com/offer/" + apiKey + "/" + userId;

        webView.loadUrl(url);
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
                view.loadUrl(request.getUrl().toString());
                return true;
            }
        });
    }
}
  1. Update Layout File:

    • Ensure your layout includes this code

activity_main
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <WebView
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</RelativeLayout>
  1. Test the Integration:

    • Run the app to verify the AdPortHub offerwall loads correctly and displays offers as expected.

Issues or Questions: Contact AdPortHub support at support@adporthub.com for assistance

Last updated