ForestG
ForestG

Reputation: 18113

Set the app's display name in a notification

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");
        })
}

Upvotes: 4

Views: 2467

Answers (1)

Oussama Belabbas
Oussama Belabbas

Reputation: 196

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"...

Upvotes: 4

Related Questions