Appearance
Installation Guide
This guide will walk you through the process of installing the Upshot Flutter SDK in your project.
Step 1: Add Plugin to your project
Upshot.ai can be integrated to your Flutter apps using flutter_upshot_plugin. Upshot.ai Flutter Plugin will enable you to track events, send notifications, and In-app messages to your audience on your Flutter app.
Add Dependency
Add flutter_upshot_plugin to your pubspec.yaml under dependencies:
yaml
dependencies:
flutter_upshot_plugin: ^1.2.1
Install Dependencies
Run flutter pub get
command:
bash
flutter pub get
Import the SDK
Usage of Flutter Upshot SDK in dart files:
dart
import 'package:flutter_upshot_plugin/flutter_upshot_plugin.dart';
import 'package:flutter_upshot_plugin/upshotConstants.dart';
Platform-specific Setup
Android Specific Instructions
- Add below dependencies in app's build.gradle file:
gradle
dependencies {
implementation 'com.github.Upshot-AI:upshot-android-sdk:v1.6.8x'
implementation 'androidx.appcompat:appcompat:1.1.1'
implementation "androidx.core:core:1.3.2"
implementation "androidx.work:work-runtime:2.8.1"
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "com.squareup.duktape:duktape-android:1.1.0"
implementation "com.github.bumptech.glide:glide:4.9.0"
implementation "com.github.bumptech.glide:compiler:4.9.0"
implementation 'com.google.firebase:firebase-analytics:21.2.1'
implementation 'com.google.firebase:firebase-messaging:23.1.2'
}
Application class should extend with UpshotApplication
Add permissions to AndroidManifest.xml:
xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
iOS Setup
- Update pod files for iOS
bash
cd ios && pod install
- Add required permissions to Info.plist: The app requires access to the device’s camera and photo library to enable image-sharing features in In-App Messages (IAM) and Badges.
xml
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app uses location to provide location-based features</string>
<key>NSCameraUsageDescription</key>
<string>This app uses camera for enhanced features</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app uses photo library for enhanced features</string>
- Configure Background Modes for Push Notifications:
xml
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
<string>background-fetch</string>
</array>
- Add push notification capability (if needed):
- Enable Push Notifications in Xcode project settings
- Add your APNs certificate or configure APNs key
Troubleshooting
Common Issues
Flutter Build Issues:
- Clean build:
flutter clean && flutter pub get
- Check Flutter and Dart SDK versions
- Verify plugin installation:
flutter pub deps
iOS Build Issues:
- Clean build folder:
cd ios && rm -rf build && cd ..
- Reinstall pods:
cd ios && pod deintegrate && pod install
- Check iOS deployment target (minimum iOS 9.0)
Android Build Issues:
- Clean gradle cache:
cd android && ./gradlew clean
- Check Android SDK and build tools versions
- Verify dependencies in build.gradle
Next Steps
After successful installation: