GithubHelp home page GithubHelp logo

mohamed-shalabi / flutter-mobile-number-plugin-updated Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amorenew/flutter-mobile-number-plugin

0.0 0.0 0.0 347 KB

Flutter Plugin to get the mobile number

Home Page: https://pub.dev/packages/mobile_number

License: Other

Shell 1.63% Ruby 11.13% Objective-C 4.49% Java 61.15% Dart 21.59%

flutter-mobile-number-plugin-updated's Introduction

mobile_number

This is a FLutter Plugin to get the device mobile number.

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 not return te phone number.

Installation

Link on Flutter plugins

https://pub.dev/packages/mobile_number

Note:

if you still using depecated FlutterActivty on MainActivity.java which is import of

  • import io.flutter.app.FlutterActivity;

not

  • import io.flutter.embedding.android.FlutterActivity;

then you need to add the following to your MainActivity.java

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MobileNumberPlugin.registerWith(registrarFor("com.amorenew.mobile_number.MobileNumberPlugin()"));
    }

Usage

Check Phone Permission

await MobileNumber.hasPhonePermission

Request Phone Permission

await MobileNumber.requestPhonePermission

Listen to widget resume after Phone Permission request

      if (isPermissionGranted) {
        //Get mobile number
      } else {
        //Request Phone Permission
      }
    });

Get first sim card number

    final String mobileNumber = await MobileNumber.mobileNumber;
    return mobileNumber;
  }

Get List of sim cards for dual sim cards

    final List<SimCard> simCards = await MobileNumber.getSimCards;
    return simCards;
  }

alt text

flutter-mobile-number-plugin-updated's People

Contributors

amreniouinnovent avatar amorenew avatar caio-deiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.