Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integrate D1 SDK using Flutter

Flutter is an open source framework by Google for building natively compiled, multi-platform applications from a single codebase.

To integrate D1 SDK using Flutter, refer to the following sections:

Integrating a Native SDK to a Flutter application

In Flutter, the Android and iOS platforms are generated only once.

There are two ways to integrate third party SDKs and Native components:

  • A simple approach: Update the generated native projects directly.

  • A more modular and universal approach: Create a standalone module(plugin), which is then linked and added to the Flutter application.

For simplicity, this guide will focus only on the first option.

Integrating D1 SDK to a Flutter application

This guide was tested with:

  • D1 SDK

    • 4.0.0 Android

    • 4.0.0 iOS

  • Flutter 3.16.9

  • Android Studio Giraffe | 2022.3.1

  • Xcode 14.3.1

To create a new Flutter application:

To be able to configure the D1 SDK on the Android platform for the Push provisioning use case, the application ID needs to be registered for Google Pay. Use the application ID com.thalesgroup.gemalto.d1.validation for the sandbox testing environment.

Android platform

1

Adding D1 SDK dependencies to the Flutter application.

Add the D1 SDK binaries dependencies.

Create the Android modules using D1 SDK.

2

Add the dependencies to the Flutter application.

3

Update the minimum SDK version supported to 24.

4

Add 'tools:replace="android:label"' to <application> element and xmlns:tools="http://schemas.android.com/tools" to <manifest> element at AndroidManifest.xml.

5

Add the NFC Wallet configuration files.

For more information, see NFC Wallet configuration files.

6

Update application signing keystore.

To run the NFC Wallet use case on the Android platform, the application needs to be signed with a specific keystore.

7

Add Firebase Cloud Messaging (FCM).

As NFC Wallet on the Android platform uses Firebase Cloud Messaging (FCM), Google Messaging Services has to be enabled in the Android application and the google-services.json file needs to be added.

Add the google-services.json to the Android project: validation/android/app/google-services.json.

8

Add the Host APDU Service Resource File.

For more information, see Host APDU service resource file.

10

Implement the Native Android entry point.

The following code snippet shows how to implement the methods for the Login and Configure use cases.

iOS platform

1

Add the D1 SDK binaries to the generated iOS project.

The most simple way to differentiate between the Debug and Release version of D1 SDK on the iOS platform, is to wrap the D1 SDK binaries in to Pods.

Debug Podspec

Release Podspec

2

Generate initial Podfile.

Run the following command to generate the initial Podfile.

3

Update the iOS application Podfile.

4

Implement the Native iOS entry point of the plugin.

The following code snippets show how to create the method prototypes for the Login and Configure use cases.

Calling the D1 Plugin API from the Flutter application

After the native parts for the Android and iOS platform have been added to the Flutter project, the D1 API can be accessed from the Flutter application.

References

Last updated

Was this helpful?