Skip to content

GreedyGame/demo-offerwall-react-native

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎯 Pubscale Offerwall React Native Demo

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.


📱 Features

  • ✅ 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

🚀 Getting Started

1. Clone the repository

git clone https://github.com/greedygame/demo-offerwall-react-native.git
cd demo-offerwall-react-native

2. Install dependencies

npm install
# or
yarn install

3. Run on Android

Make sure an Android emulator is running or a device is connected:

npx react-native run-android

🛠️ SDK Integration Details

🔌 Native Android Setup

  • Native files:
    • PubscaleOfferwallModule.java or PubscaleOfferwallModule.kt
    • PubscaleOfferwallPackage.java or PubscaleOfferwallPackage.kt

These expose the Offerwall SDK to React Native through NativeModules.

⚛️ JavaScript Usage

Initialize the Offerwall

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)
);

Launch the Offerwall

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)
);

🧪 UI Preview

  • Modern responsive layout
  • Launch button appears after initialization
  • Full-width image at the bottom of screen

🧠 Notes

  • 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

🙌 Credits

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published