← Back to Documentation
Mobile Integration

Mobile App Integration

How the USSD Pad Flutter app discovers registered codes and routes users to the correct platform.

How Code Discovery Works

  1. On startup, the app calls GET /api/codes to fetch all registered codes and caches them locally.
  2. When a user dials a USSD code (e.g., *737#), the app checks its local cache first.
  3. If the code is found, the app creates a USSDPadSession and sends requests to POST /api/session.
  4. If the code is not found and a Plug Bundle API key is configured, it falls through to the existing Plug Bundle flow.

Session Flow

1

Dial *737#

App sends POST /api/session { code: "*737#" }

2

Root Menu

Backend returns menu: "Welcome to DataZone GH. 1. Buy Data 2. Balance 3. Check Order"

3

Select Option

User taps "1" → app sends { input: "1", step: "root" }

4

Navigate Menu

User continues through screens until terminal state is reached or payment is needed.

Configuring the Backend URL

In lib/app.dart, update the backend URL to point to your server:

// Android emulator
static const _defaultBackendUrl = 'http://10.0.2.2:8080';

// iOS simulator
static const _defaultBackendUrl = 'http://localhost:8080';

// Physical device (same network)
static const _defaultBackendUrl = 'http://192.168.1.100:8080';

After updating, rebuild the app with flutter run.