Gereklilikler
iOS 10.0 veya üzeri
Android API level 21 veya üzeri
Kurulum
Projenizin
pubspec.yaml
dosyasını alttaki şekilde güncelleyindependencies: relateddigital_flutter: ^0.1.0
flutter pub get
komutunu çalıştırınPaketi içeri aktarın
import 'package:relateddigital_flutter/relateddigital_flutter.dart';
Platform Entegrasyonları
Android
project/build.gradle
dosyanızdaki ikirepositories
bölümüne alttaki satırı ekleyin.maven {url 'http://developer.huawei.com/repo/'} // skip if your app does not support HMS
project/build.gradle
dosyanızdakidependencies
bölümüne alttaki satırları ekleyin.classpath 'com.google.gms:google-services:4.3.5' classpath 'com.huawei.agconnect:agcp:1.4.1.300' // skip if your app does not support HMS
app/build.gradle
dosyanızın en altına alttaki satırları ekleyin.apply plugin: 'com.google.gms.google-services' apply plugin: 'com.huawei.agconnect' // skip if your app does not support HMS
app/build.gradle
dosyanızındefaultConfig
alanındakiminSdkVersion
değerini21
olarak düzenleyin.AndroidManifest.xml
dosyanızın<application></application>
etiketleri arasına alttaki satırları ekleyin.<service android:name="euromsg.com.euromobileandroid.service.EuroFirebaseMessagingService" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <!-- skip if your app does not support HMS --> <service android:name="euromsg.com.euromobileandroid.service.EuroHuaweiMessagingService" android:exported="false"> <intent-filter> <action android:name="com.huawei.push.action.MESSAGING_EVENT" /> </intent-filter> </service>
Firebase panelinden alacağınız
google-services.json
dosyasını projenizinandroid/app
dizinine ekleyin.Uygulamanızda HMS desteği varsa
agconnect-services.json
dosyasınıandroid/app
dizinine ekleyin.
iOS
Podfile
dosyanızdaki ios platform versiyonunu10.0
veya üzeri olarak değiştirin.platform :ios, '10.0'
Proje dizininizde
ios/Runner.xcworkspace
dosyasını Xcode ile açın.Signing & Capabilities
sekmesindenPush Notifications
veBackground Modes->Remote Notifications
özelliklerini etkinleştirin.
Kullanım
Başlatma
Kütüphaneyi sayfaya ekleyin.
import 'package:relateddigital_flutter/relateddigital_flutter.dart'; import 'package:relateddigital_flutter/request_models.dart'; import 'package:relateddigital_flutter/response_models.dart';
Alttaki şekilde konfigürasyonları tamamlayın.
organizationId
,siteId
,dataSource
,appAlias
gibi parametrelerin değerleri için RMC ekibiyle iletişime geçin.final RelateddigitalFlutter relatedDigitalPlugin = RelateddigitalFlutter(); @override void initState() { super.initState(); initLib(); } Future<void> initLib() async { var initRequest = RDInitRequestModel( appAlias: Platform.isIOS ? 'ios-alias' : 'android-alias', huaweiAppAlias: 'huawei-alias', // pass empty String if your app does not support HMS androidPushIntent: 'com.test.MainActivity', // Android only organizationId: 'ORG_ID', siteId: 'SITE_ID', dataSource: 'DATA_SOURCE', maxGeofenceCount: 20, // iOS only geofenceEnabled: true, inAppNotificationsEnabled: true, // iOS only logEnabled: true, ); await relatedDigitalPlugin.init(initRequest); }