⚑SDK Initialization

πŸ§‘β€πŸ’» Integration Guide

1. Flutter Implementation

In your main.dart file:

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  static const platform = MethodChannel('com.example.offerwall_app');

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('AdJump Example')),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              _launchOfferWall();
            },
            child: Text('Launch OfferWall'),
          ),
        ),
      ),
    );
  }

  Future<void> _launchOfferWall() async {
    try {
      final Map<String, String> params = {
        'accountId': 'YOUR_ACCOUNT_ID',
        'appId': 'YOUR_APP_ID',
        'userId': 'USER_ID',
      };
      await platform.invokeMethod('launchOfferWall', params);
    } on PlatformException catch (e) {
      print("Failed to show offer wall: '${e.message}'.");
    }
  }
}

2. Android Implementation

In your MainActivity.kt:


πŸ”‘ Configuration

  1. Replace the placeholder values in your Flutter code with your actual Adjump credentials:

    • YOUR_ACCOUNT_ID: Your Adjump account identifier

    • YOUR_APP_ID: Your application identifier

    • USER_ID: The user identifier for the current session

  2. Make sure the method channel name matches in both Flutter and Android code:


πŸ§ͺ Testing

  • Make sure you're running on a physical Android device or emulator with internet access

  • Log output and Toast messages will indicate:

    • SDK initialization status

    • Offerwall availability

    • Any errors that occur during the process


❓ FAQ

Q: Does it support iOS? A: No, this SDK currently supports Android only.

Q: Where do I get my accountId, appId, and userId? A: These are provided by the Adjump platform once you're onboarded.

Q: What happens if the credentials are invalid? A: The SDK will show an error message through a Toast notification and log the error details.


Last updated