Skip to content

dusic1997/FlutterSimNumberPlugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimNumber plugin for Flutter

A Flutter plugin to retrieve Sim cards data - dual sim support.

Note: It works for Android only because getting mobile number of sim card is not supported in iOS.

Note: If the mobile number is not pre-exist on sim card it will return sim slot index and operator name.

Installation

Add simnumber as a dependency in your pubspec.yaml.

Make sure that your AndroidManifext.xml file includes the following permission:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />

Usage

Before you use this plugin, you must make sure that the user has authorized access to his phone, for example with the permission_handler plugin.

You may then use the plugin:

import 'package:simnumber/sim_number.dart';

void printSimCardsData() async {
  try {
    SimInfo simInfo = await SimNumber.getSimData();
    for (var s in simInfo.cards) {
      print('Serial number: ${s.slotIndex} ${s.phoneNumber}');
    }
  } on Exception catch (e) {
    debugPrint("error! code: ${e.code} - message: ${e.message}");
  }
}

void main() => printSimCardsData();

About

Get SIM Details from Android Device

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 47.1%
  • Dart 23.2%
  • Ruby 11.9%
  • Shell 5.6%
  • Swift 4.9%
  • Objective-C 3.7%
  • Java 3.6%