4

I have a Flutter mobile app, using Google Cloud functions and Google Cloud Messaging. Currently testing with IntelliJ Android Emulator.

Anytime a Cloud Function sends a push notification, the app name is the same, as the applicationId entry in build.gradle.

And that's bad, as it shows my app name with underscores.

So if the applicationId is 'com.secretcompany.my_super_secret_application`, then the app name in the notifications will be my_super_secret_application instead of My Super Secret Application. (sorry for obfuscating the image, company policy.) enter image description here

Is there a way, to set up the display name from the admin SDK in Google Clouds? Or a way to easily change the app name? Or is it just because I am using an emulated device, and once the app will be released to the store the problem will be gone?

This code sends the notification:

function sendNotificationToUser(title: string, body: string, userFcm: string) {
    const notificationContent = {
        notification: {
            title: title,
            body: body,
            badge: '1',
            click_action: 'FLUTTER_NOTIFICATION_CLICK',
        },
    };
    admin.messaging().sendToDevice(userFcm, notificationContent)
        .then(() => {
            return;
        })
        .catch(error => {
            functions.logger.error("Error in sending notification");
        })
}
ForestG
  • 17,538
  • 14
  • 52
  • 86

1 Answers1

4

if I understood your question correctly, I believe you can change your App name in the Androidmanifest.xml in " project_name\android\app\src\main\AndroidManifest.xml "

Change the label to the name you want for your App:

 <application
    android:name="io.flutter.app.FlutterApplication"
    android:label="app_name"...
ForestG
  • 17,538
  • 14
  • 52
  • 86
Oussama Belabbas
  • 196
  • 1
  • 10
  • Thanks for the answer! Are you sure it's not the `project_name/android/app/src/main/AndroidManifest.xml `? The one you mentioned does not has those lines. – ForestG Nov 24 '20 at 12:59
  • 2
    yep, changing the parameter you mentioned fixed the problem. Ty. – ForestG Nov 24 '20 at 13:05