パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.1.0

ussd_advanced

アプリケーション内で直接 USSD コードを実行でき、単一セッションおよびマルチセッションの USSD 呼び出しをサポートしています

AndroidiOS
30日間ダウンロード
54
いいね数
62
Pub ポイント
130

パッケージをインストール

flutter pub add ussd_advanced

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

ussd_advanced パッケージは、Android および iOS 上の Flutter アプリケーションで USSD(非構造化補助サービスデータ)コードを直接実行できるようにします。単一セッションおよびマルチセッションの USSD インタラクションをサポートしており、ユーザーがプログラム的に USSD セッションを開始および管理できます。モバイルデバイス統合を目的として設計されており、アプリとデバイスのネイティブな USSD 機能との間のブリッジを提供します。銀行、通信サービス、およびネットワークベースのサービスとリアルタイムでやり取りが必要なユーティリティアプリに最適です。

用途

  • モバイルバンキング USSD インテグレーション
  • 通信サービスへのアクセス
  • 公共料金の支払い
  • リアルタイムカスタマーサポート
  • ネットワークサービスの照会

主な機能

  • シングルおよびマルチセッション USSD をサポート
  • 直接 USSD コードの実行
  • クロスプラットフォームのAndroid/iOS互換性
  • セッション管理のためのシンプルな API
  • ネイティブデバイスレベルのUSSDアクセス

適している対象

  • USSDを必要とする金融アプリ
  • 通信サービスプロバイダ
  • 政府サービスポータル
  • モバイルウォレットの統合
  • 新興市場向けのアプリ

注意事項

  • デバイスレベルの権限が必要です
  • USSD対応デバイスに限定
  • すべてのキャリアで動作しない可能性があります
  • ネイティブOS実装に依存
  • サポートされていないデバイスのフォールバックなし

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

ussd_advanced

Run ussd code directly in your application

Usage

Add dependency to pubspec.yaml file

Android

You'll need to add the CALL_PHONE permission and READ_PHONE_STATE to your Android Manifest.

    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
For android mutli-session ussd

Add ussd dialog accessibility service to your Android Manifet inside application

<application>
...
  <service
      android:name="com.phan_tech.ussd_advanced.USSDServiceKT"
      android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
      android:exported="false">
      <intent-filter>
          <action android:name="android.accessibilityservice.AccessibilityService" />
      </intent-filter>
      <meta-data
          android:name="android.accessibilityservice"
          android:resource="@xml/ussd_service" />
  </service>
</application>
iOS

Add this to your info.plist under dict

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>tel</string>
</array>
Example
import 'package:flutter/material.dart';

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

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late TextEditingController _controller;
  String? _response;

  @override
  void initState() {
    super.initState();
    _controller = TextEditingController();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Ussd Plugin example'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          mainAxisSize: MainAxisSize.max,
          children: [
            // text input
            TextField(
              controller: _controller,
              keyboardType: TextInputType.phone,
              decoration: const InputDecoration(labelText: 'Ussd code'),
            ),

            // dispaly responce if any
            if (_response != null)
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 8),
                child: Text(_response!),
              ),

            // buttons
            Row(
              mainAxisSize: MainAxisSize.max,
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                ElevatedButton(
                  onPressed: () {
                    UssdAdvanced.sendUssd(code: _controller.text, subscriptionId: 1);
                  },
                  child: const Text('norma\nrequest'),
                ),
                ElevatedButton(
                  onPressed: () async {
                    String? _res = await UssdAdvanced.sendAdvancedUssd(code: _controller.text, subscriptionId: 1);
                    setState(() {
                      _response = _res;
                    });
                  },
                  child: const Text('single session\nrequest'),
                ),
                ElevatedButton(
                  onPressed: () async {
                    String? _res = await UssdAdvanced.multisessionUssd(code: _controller.text, subscriptionId: 1);
                    setState(() {
                      _response = _res;
                    });
                    String? _res2 = await UssdAdvanced.sendMessage('0');
                    setState(() {
                      _response = _res2;
                    });
                    await UssdAdvanced.cancelSession();
                  },
                  child: const Text('multi session\nrequest'),
                ),
              ],
            )
          ],
        ),
      ),
    );
  }
}

Methods
  • The sendUssd runs the ussd normaly without a response.
  • The sendAdvancedUssd (single session call) runs ussd in background and gives you the response as a string. It only surports android 8+(SDK 26+). It defaults to sendUssd when the SDK is lower. For multisession USSDs, send the request as one, ie;
UssdAdvanced.sendAdvancedUssd(code: "*123*1*4*3#", subscriptionId: -1);
  • The multisessionUssd runs a multi session call giving all the sessions response as String. One can interact with the ussd dialog by sending a message using sendMessage method and canceling the session by calling cancelSession
Selecting SimCard

You can select which simcard to use providing subscriptionId. -1: is for default phone setting. Only supports android 6+, and defaults to default if the SDK is lower

Support the plugin Buy Me A Coffee

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。