Skip to content

RandyWei/flt_telephony_info

Repository files navigation

flt_telephony_info

get telephony info:

Android:based on TelephonyManager

iOS:based on CoreTelephony

ENGLISH | 中文

Installation

//pub
dependencies:
  flt_telephony_info: any

//import
dependencies:
  flt_telephony_info:
    git:
      url: git://github.com/RandyWei/flt_telephony_info.git

Android

dataNetworkType

Requires permission:android.permission.READ_PHONE_STATE

deviceSoftwareVersion

Requires permission:android.permission.READ_PHONE_STATE

IMEI(International Mobile Equipment Identity)(imei)

Requires permission:android.permission.READ_PHONE_STATE

isDataEnabled

Requires one of the following permissions:

android.permission.ACCESS_NETWORK_STATE

android.permission.MODIFY_PHONE_STATE

line1Number

Requires one of the following permissions:

android.permission.READ_PHONE_STATE

android.permission.READ_SMS

android.permission.READ_PHONE_NUMBERS

MEID (Mobile Equipment Identifier)(meid)

Requires permission:android.permission.READ_PHONE_STATE

Network Access Identifier (NAI)

Requires permission:android.permission.READ_PHONE_STATE

<manifest
    ...
    xmlns:tools="http://schemas.android.com/tools" >
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
    <uses-permission android:name="android.permission.READ_SMS"/>
    <uses-permission android:name="android.permission.READ_PHONE_NUMBERS"/>
    ...
</manifest>

iOS

Getting Information About the Cellular Service Provider

var allowsVOIP: Bool

Indicates if the carrier allows making VoIP calls on its network.

var carrierName: String?

The name of the user’s home cellular service provider.

var isoCountryCode: String?

The ISO country code for the user’s cellular service provider.

var mobileCountryCode: String?

The mobile country code (MCC) for the user’s cellular service provider.

var mobileNetworkCode: String?

The mobile network code for the user’s cellular service provider.

Example

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

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  TelephonyInfo _info;

  @override
  void initState() {
    super.initState();
    getTelephonyInfo();
  }

  Future<void> getTelephonyInfo() async {
    TelephonyInfo info;
    try {
      info = await FltTelephonyInfo.info;
    } on PlatformException {}

    if (!mounted) return;

    setState(() {
      _info = info;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Phone Number: ${_info?.line1Number}\n'),
        ),
      ),
    );
  }
}

Other

Home Page

Video Player Based On TxVodPlayer

About

获取SIM卡信息

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •