Skip to content

0ttik/phone_hint_android

 
 

Repository files navigation

phone_hint_android

Flutter plugin for Phone Number Hint Api on Android, provides a frictionless way to show a user's (SIM-based) phone numbers as a hint.

demo

Setup & Usage

import com.technikb.phone_hint_android.PhoneHintAndroidMethodCallHandler
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine

class MainActivity : FlutterFragmentActivity() {
   override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
       super.configureFlutterEngine(flutterEngine)
       PhoneHintAndroidMethodCallHandler.register(flutterEngine, this)
   }
}
  1. Replace FlutterActivity with FlutterFragmentActivity
  2. Add PhoneHintAndroidMethodCallHandler.register(flutterEngine, this) in configureFlutterEngine method

Example usage:

final phoneNumber = await PhoneHintAndroid().getPhoneNumber();

Benefits

  • No additional permission requests are needed
  • Eliminates the need for the user to manually type in the phone number
  • No Google account is needed
  • Not directly tied to sign in/up workflows
  • Wider support for Android versions compared to Autofill

Utilised Google's Phone Number Hint Api

Support phone_hint_android

You can support phone_hint_android by liking it on Pub and staring it on Github, sharing ideas on how we can enhance a certain functionality or by reporting any problems you encounter.

About

Android phone hint flutter plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 62.0%
  • Kotlin 38.0%