Android in Google Analytics (#3685)
* android GA * test for now * removed test android * formatting and pangea comments --------- Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com> Co-authored-by: ggurdin <ggurdin@gmail.com>
This commit is contained in:
parent
ba38633c47
commit
598820295f
7 changed files with 46 additions and 12 deletions
|
|
@ -2,7 +2,7 @@ plugins {
|
|||
id "com.android.application"
|
||||
id "kotlin-android"
|
||||
id "dev.flutter.flutter-gradle-plugin"
|
||||
//id "com.google.gms.google-services"
|
||||
id "com.google.gms.google-services"
|
||||
}
|
||||
|
||||
def localProperties = new Properties()
|
||||
|
|
@ -100,7 +100,10 @@ flutter {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
//implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698
|
||||
implementation platform('com.google.firebase:firebase-bom:32.8.0')
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
implementation 'com.google.firebase:firebase-database'
|
||||
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "545984292675",
|
||||
"firebase_url": "https://pangea-chat-936ee-default-rtdb.firebaseio.com",
|
||||
"project_id": "pangea-chat-936ee",
|
||||
"storage_bucket": "pangea-chat-936ee.appspot.com"
|
||||
"storage_bucket": "pangea-chat-936ee.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,4 +14,14 @@ subprojects {
|
|||
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.google.gms:google-services:4.4.1'
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ plugins {
|
|||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||
id "com.android.application" version "8.7.3" apply false
|
||||
id "org.jetbrains.kotlin.android" version "2.1.10" apply false
|
||||
// id "com.google.gms.google-services" version "4.3.8" apply false
|
||||
id "com.google.gms.google-services" version "4.3.8" apply false
|
||||
}
|
||||
|
||||
include ":app"
|
||||
|
|
@ -52,7 +52,7 @@ class DefaultFirebaseOptions {
|
|||
projectId: 'pangea-chat-936ee',
|
||||
authDomain: 'pangea-chat-936ee.firebaseapp.com',
|
||||
databaseURL: 'https://pangea-chat-936ee-default-rtdb.firebaseio.com',
|
||||
storageBucket: 'pangea-chat-936ee.appspot.com',
|
||||
storageBucket: 'pangea-chat-936ee.firebasestorage.com',
|
||||
measurementId: 'G-FKP13VDEBX',
|
||||
);
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ class DefaultFirebaseOptions {
|
|||
messagingSenderId: '545984292675',
|
||||
projectId: 'pangea-chat-936ee',
|
||||
databaseURL: 'https://pangea-chat-936ee-default-rtdb.firebaseio.com',
|
||||
storageBucket: 'pangea-chat-936ee.appspot.com',
|
||||
storageBucket: 'pangea-chat-936ee.firebasestorage.com',
|
||||
androidClientId:
|
||||
'545984292675-2amsnoan1mt6lec1fld1a7eagu6gej7o.apps.googleusercontent.com',
|
||||
);
|
||||
|
|
@ -73,7 +73,7 @@ class DefaultFirebaseOptions {
|
|||
messagingSenderId: '545984292675',
|
||||
projectId: 'pangea-chat-936ee',
|
||||
databaseURL: 'https://pangea-chat-936ee-default-rtdb.firebaseio.com',
|
||||
storageBucket: 'pangea-chat-936ee.appspot.com',
|
||||
storageBucket: 'pangea-chat-936ee.firebasestorage.com',
|
||||
iosClientId:
|
||||
'545984292675-f5p76l3h9sibsonrct7a8l9ca3c69at0.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.talktolearn.chat',
|
||||
|
|
@ -85,7 +85,7 @@ class DefaultFirebaseOptions {
|
|||
messagingSenderId: '545984292675',
|
||||
projectId: 'pangea-chat-936ee',
|
||||
databaseURL: 'https://pangea-chat-936ee-default-rtdb.firebaseio.com',
|
||||
storageBucket: 'pangea-chat-936ee.appspot.com',
|
||||
storageBucket: 'pangea-chat-936ee.firebasestorage.com',
|
||||
iosClientId:
|
||||
'545984292675-f5p76l3h9sibsonrct7a8l9ca3c69at0.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.talktolearn.chat',
|
||||
|
|
|
|||
|
|
@ -24,10 +24,20 @@ class GoogleAnalytics {
|
|||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
} on Exception {
|
||||
// Android initialises using gradle plugin
|
||||
// So we just get the one they added
|
||||
app = Firebase.app();
|
||||
}
|
||||
|
||||
analytics = FirebaseAnalytics.instanceFor(app: app);
|
||||
|
||||
debugPrint("Firebase App Name: ${app.name}");
|
||||
debugPrint("Firebase App Options:");
|
||||
debugPrint(" App ID: ${app.options.appId}");
|
||||
debugPrint(" Project ID: ${app.options.projectId}");
|
||||
debugPrint(" Database URL: ${app.options.databaseURL}");
|
||||
debugPrint(" Messaging Sender ID: ${app.options.messagingSenderId}");
|
||||
debugPrint(" Storage Bucket: ${app.options.storageBucket}");
|
||||
}
|
||||
|
||||
static analyticsUserUpdate(String? userID) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fcm_shared_isolate/fcm_shared_isolate.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:flutter_new_badger/flutter_new_badger.dart';
|
||||
|
|
@ -92,6 +91,19 @@ class BackgroundPush {
|
|||
),
|
||||
onDidReceiveNotificationResponse: goToRoom,
|
||||
);
|
||||
|
||||
// #Pangea
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
pushHelper(
|
||||
PushNotification.fromJson(message.data),
|
||||
client: client,
|
||||
l10n: l10n,
|
||||
activeRoomId: matrix?.activeRoomId,
|
||||
flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin,
|
||||
);
|
||||
});
|
||||
// Pangea#
|
||||
|
||||
Logs().v('Flutter Local Notifications initialized');
|
||||
firebase?.setListeners(
|
||||
onMessage: (message) => pushHelper(
|
||||
|
|
@ -107,6 +119,7 @@ class BackgroundPush {
|
|||
onNewToken: _newFcmToken,
|
||||
// Pangea#
|
||||
);
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
await UnifiedPush.initialize(
|
||||
onNewEndpoint: _newUpEndpoint,
|
||||
|
|
@ -547,9 +560,6 @@ class BackgroundPush {
|
|||
// #Pangea
|
||||
Future<String?> _getToken() async {
|
||||
if (Platform.isAndroid) {
|
||||
await Firebase.initializeApp(
|
||||
// options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
return (await FirebaseMessaging.instance.getToken());
|
||||
}
|
||||
return await firebase?.getToken();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue