# Installation
Flutter version for Android and iOS platforms
Step 1. Import SDK
To import our library run this command in terminal:
flutter pub add flutter_user_sdk
this will add a line like this to your package’s pubspec.yaml
:
dependencies:
flutter_user_sdk: 0.0.1
Step 2. Setup project
UserComSDK uses FCM inside the package. You need to make additional steps to work with our package
2.1 Android setup:
Add following lines to Android build.gradle and app/build.gradle files:
dependencies {
...
classpath 'com.google.gms:google-services:4.3.3'
}
apply plugin: com.google.gms.google-services
Create a new Firebase project. Make sure that applicationId is the same as Android package name.
Download google-services.json
and add it to Android folder.
That's it. Project is ready to launch.
2.2 IOS setup:
Create a new Firebase project. Make sure that XCode bundleId is the same as Apple Bundle Id.
Download GoogleService-Info.plist and add it to Runner folder via XCode.
Then add Push Notification capability in XCode. This should automatically generate a Key in Your signing certificates in App Store Connect.
Your in app messages Should be ready to use.
Package collects data about the user. Open Info.plist and add the following line.
Your project is ready to use.
NOTE
If Your app is not receiving notifications - check if Firebase server key is pasted inside User.com Settings -> Advanced -> Mobile Fcm Keys
Step 3. Configure SDK in your app
In your main()
function initialize UserComSDK instance by calling UserComSDK.instance.initialize(...)
method. You have to provide SDK API key and base URL.
NOTE
If you want to debug request responses, set enableDebugging to true.
You can generate API key in User.com web panel. It was described in getting started section
void main() {
WidgetsFlutterBinding.ensureInitialized();
FlutterUserSdk.instance.initialize(
userSdkKey: '', // Insert here a key from User.com
appDomain: '', // Url your in which your app is hosted
enableLogging: true, // false is default,
);
runApp(const MyApp());
}