Flutter plugin to support PingID SDK Integration. Currently implemented all events and mostly methods of the SDK v1.11.
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.
-
Add the PingID_SDK.aar module as PingID_SDK to your project using this instructions.
-
Update your
[project]/android/local.propertiesfile with your PingID application.
...
ping.applicationId=YOUR_APP_IDIf 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.jsonfile and place it insideandroid/app. -
Add the classpath to the
[project]/android/build.gradlefile.
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.gradlefile.
apply plugin: 'com.google.gms.google-services'- Update your
[project]/android/local.propertiesfile with your Firebase's project Push Sender ID.
...
ping.pushSenderId=YOUR_PUSH_SENDER_ID-
Create the APNS Certificates from your Apple Developer account and upload them to PingOne.
-
On your project navigator, go to General and then drag the PingID_SDK.xcframework to Frameworks, Libraries, and Embedded Content
-
Go to Signing & Capabilities and enable Push Notifications and Background Modes -> Remote notifications
-
You need to create as bridge to PingID ObjC code, you can use the file created by Flutter for that
Runner-Bridging-Header.h
#import "GeneratedPluginRegistrant.h"
#import <PingID_SDK/PingId.h>-
Add
NSLocationWhenInUseUsageDescriptionto your project'sInfo.plist -
Create a file called
Ping.plistwith your Ping configuration:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Your PingID SDK Application ID -->
<key>APPLICATION_ID</key>
<string>APP_ID</string>
<!-- Use Sandbox APNS certificate -->
<key>DEBUG_CERTIFICATE</key>
<true/>
</dict>
</plist>