pingidsdk 0.0.3 pingidsdk: ^0.0.3 copied to clipboard
Flutter plugin for PingID SDK
pingidsdk plugin #
A Flutter plugin to use the PingID SDK.
Usage #
Add pingidsdk
as as dependency and download the PingID SDK Integration Kit. You may need to create an account to do so.
To use the authentication flows, you will also need a linked Firebase project.
Import the package in your .dart file and get the PingIDSDK instance
import 'package:pingidsdk/pingidsdk.dart' as ping;
final ping.PingIDSDK _ping = ping.PingIDSDK.instance;
All PingID SDK events are available throught Streams, so you need to listen for them and after they are no longer needed, you should call .cancel()
to prevent leaks.
StreamSubscription<ping.PairingCompleted> _pairingCompletedSub;
@overrride
void initState() {
super.initState();
init();
}
Future<void> init() async {
_pairingCompletedSub = _ping.pairingCompleted.listen((args) async {
//Pairing completed event called from native code
});
//Calling SDK method from Flutter
bool isTrusted = await _ping.deviceIsTrusted;
}
@override
void dispose() {
_pairingCompletedSub.cancel();
super.dispose();
}
For instructions on how does PingID SDK works, please check Ping Identity documentation.
Installation #
Android integration #
-
Add the PingID_SDK.aar module as PingID_SDK to your project using this instructions.
-
Update your
[project]/android/local.properties
file with your PingID application.
...
ping.applicationId=YOUR_APP_ID
If you wish to use authentication as well, you need to also make the following changes:
-
Using the Firebase Console add an Android app to your project: Follow the assistant, download the generated
google-services.json
file and place it insideandroid/app
. -
Add the classpath to the
[project]/android/build.gradle
file.
dependencies {
...
// Add the google services classpath
classpath 'com.google.gms:google-services:4.3.2'
}
- Add the apply plugin to the
[project]/android/app/build.gradle
file.
apply plugin: 'com.google.gms.google-services'
- Update your
[project]/android/local.properties
file with your Firebase's project Push Sender ID.
...
ping.pushSenderId=YOUR_PUSH_SENDER_ID
iOS Integration #
Not yet supported