1-) FLUTTER - android ve ios fcm push firebase cloud messaging fast entegre kullanımı 2024
önemli not. uygulama kapalıyken tıkladığın zaman. mesaj buraya gelir. sharedpreferences ile kaydet açılınca veriyi oku.
birinci yol
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage? message) {
|
ikinci yol
Future<void> backgroundHandler(RemoteMessage message) async { |
***************** ANDROİD VE İOS ENTEGRESİ *****************
github kaynak : https://github.com/ramazanhaber/flutterandroidiosfcm2024
aşağıdakinide ekle çünkü izin vs diyor
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
1.ADIM - android->app->src->main->AndroidManifest.xml'e INTERNET ve CleartextTraffic i ekle . aşağıdaki gibi
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
2.ADIM - android->app->build.gradle'a (minSdkVersion 21)(targetSdkVersion 33)(compileSdkVersion 33) yap
3.ADIM - https://console.firebase.google.com/u/0/ adresinden create a project diyip rastegele isim ver ve bir hesabın oluşuacak
4.ADIM - aşağıdaki gibi android yazan kısımdan ilerle
5.ADIM -
6.ADIM - android->app->build.gradleye (apply plugin: 'com.google.gms.google-services') ve en aşağıya bunu ekle
implementation platform('com.google.firebase:firebase-bom:31.2.3')
implementation 'com.google.firebase:firebase-analytics-ktx'
7.ADIM - android->build.gradleye (classpath 'com.google.gms:google-services:4.3.15') bunu ekle
8.ADIM - uygulamayı kapat aç
9.ADIM - firebase->proje settings->cloud messaging-> Enable yap -> orası okey dicek ve server key vericek aşağıdaki gibi
10.ADIM -Aşağıdakileri terminale yaz ve çalıştır
flutter pub add firebase_core (^2.9.0) flutter pub add firebase_messaging (^14.4.0) flutter pub add flutter_local_notifications (^13.0.0 )
|
11.ADIM - Info.plist e aşağıdakini ekle
<key>FirebaseAppDelegateProxyEnabled</key> |
13.ADIM ilk olarak GoogleService-Info.plist dosyasını XCODE idesinde Runner klasörüne sağ tıklayıp "Add files to Runner" diyelim
NOT BURASI ÇOK ÖNEMLİ ADD FİLES TO RUNNER DEDİKTEN SONRA GoogleService-Info.plist DOSYASINI SEÇMELİSİN
14.ADIM ios Devoloper account daki keyid ve teamid -> FCM deki ile aynı olacak -> aşağıdaki iki resimden görebilirsiniz
https://developer.apple.com/account/resources/certificates/list
_firebaseMessaging.requestPermission(); runApp(MyApp());
|