This repository contains a React Native demo app that showcases how to integrate and launch the Pubscale Offerwall SDK in a React Native Android application.
- ✅ React Native (JavaScript)
- ✅ Native module bridge to Android
- ✅ Initialize and launch Pubscale Offerwall
- ✅ Handle offerwall events: init_success, init_fail, show, close, reward, error
- ✅ Optional support for Base64 background and app icon images
git clone https://github.com/greedygame/demo-offerwall-react-native.git
cd demo-offerwall-react-nativenpm install
# or
yarn installMake sure an Android emulator is running or a device is connected:
npx react-native run-android- Native files:
PubscaleOfferwallModule.javaorPubscaleOfferwallModule.ktPubscaleOfferwallPackage.javaorPubscaleOfferwallPackage.kt
These expose the Offerwall SDK to React Native through NativeModules.
import { NativeModules } from "react-native";
const { PubscaleOfferwall } = NativeModules;
PubscaleOfferwall.init(
"YOUR_APP_KEY", // Replace with actual app key from Pubscale
{
user_id: "USER_ID",
sandbox: false, // true if you want to enable sandbox
// background_Base64: "data", // Optional
// appicon_Base64: "data" // Optional
},
() => console.log("Offerwall initialized"),
(error) => console.error("Init failed", error)
);PubscaleOfferwall.launch(
() => console.log("Offerwall shown"),
() => console.log("Offerwall closed"),
(amount, currency, token) => {
console.log("Reward received:", amount, currency, token);
},
(error) => console.error("Offerwall error", error)
);- Modern responsive layout
- Launch button appears after initialization
- Full-width image at the bottom of screen
- iOS is not supported in this demo.
- For production, remember to:
- Set
sandbox: false - Use a real
user_id - Handle reward validations securely on the server side
- Set
- Pubscale Offerwall SDK
- React Native Community
- Expo Modules (for lifecycle handling)