0 purchases
branch sdk
branch_sdk #
This plugin is a wrapper for the Branch SDK.
Features #
Basic Integration.
Install Attribution.
Note: This plugin is still in alpha and provides little interfacing with the Branch SDK at the moment. Rest assured, the plugin is still being actively developed. Provided interfaces/features are production ready.
Getting started #
Add the below to your pubspec.yaml file.
dependencies:
branch_sdk: ^1.0.0-alpha.5
copied to clipboard
and run flutter pub get
For iOS you need to go further in to your ios folder and run pod install. You need to install cocoapods for that.
and import with
import 'package:branch_sdk/branch_sdk.dart';
copied to clipboard
Usage #
Basic Integration #
To basically setup the Branch SDK you need to follow the below instructions based on platform of choice.
iOS Setup #
As described in the official docs here, Add the below to your Info.plist file
<!-- App Key -->
<key>branch_key</key>
<string>key_live_or_test</string>
copied to clipboard
<!-- Register a URI Scheme -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>your_app_scheme</string>
</array>
</dict>
</array
copied to clipboard
You can obtain the live or test keys from your DashBoard. If you want to set the test and prod keys at the same time, you can add this instead in your Info.plist file for the branch_key value.
<key>branch_key</key>
<dict>
<key>live</key>
<string>live_key</string>
<key>test</key>
<string>test_key</string>
</dict>
copied to clipboard
To support Universal Links, follow the instructions here
Android Setup #
Add the below to your AndroidManifest.xml file just within the <application> tag.
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_abc" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_abc" />
<!-- Set to use Live or Test Key -->
<meta-data android:name="io.branch.sdk.TestMode" android:value="true" />
copied to clipboard
Initializing #
To initialize Branch do the following:
import 'package:branch_sdk/branch_sdk.dart';
BranchSdk.init(debug: true); // Set debug to true to use test key and enable logging. Note io.branch.sdk.TestMode in AndroidManifest.xml must be set to true for debug:true to work.
copied to clipboard
To guarantee the success of this function, ensure you've called the below in the app's main function
WidgetsFlutterBinding.ensureInitialized();
copied to clipboard
To verify your integration, do the following:
import 'package:branch_sdk/branch_sdk.dart';
BranchSdk.init(debug: true);
BranchSdk.validateSDKIntegration(); // Remember to remove this in production.
copied to clipboard
Additional information #
For a practical example, see the package example section.
Contributing #
Pull requests are welcome.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.