Skip to content

[Bug]: No show app icon badge dots or counts on Huawei device #1026

Open
@caini1213

Description

@caini1213

What happened?

Hi, I'm using flutter One Signal with FCM to push notification message for IOS and Android devices.
When i test with Huawei device (without Google Play service):

  1. It did not prompt out notification permission when first time login the app
  2. I'm still able to receive notifications but no icon badges count or dot on my app.
  3. May I know is there any settings that i need to go through?

My Huawei EMUI version = 10.1.0

Steps to reproduce?

Library using:
onesignal_flutter: ^5.3.0

app/build.gradle

buildscript {
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://developer.huawei.com/repo/'
        }
    }

    subprojects {
        afterEvaluate { project ->
            if (project.plugins.hasPlugin("com.android.library")) {
                project.android {
                    if (namespace == null) {
                        namespace project.group
                    }
                }
            }
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:8.1.0'
        classpath 'com.huawei.agconnect:agcp:1.9.1.304'
    }
}

allprojects {
    repositories {
        google()
        maven { url 'https://developer.huawei.com/repo/' }
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

app/android/build.gradle

dependencies {
    implementation 'com.huawei.agconnect:agconnect-core:1.9.1.304'
    implementation 'com.onesignal:OneSignal:[5.0.0, 5.99.99]'
    implementation 'com.huawei.hms:push:6.3.0.304'
}

apply plugin: 'com.huawei.agconnect'
Future<void> _configureOneSignalNotification() async {
    bool hasPermission = OneSignal.Notifications.permission;

    if (hasPermission) {
      await _registerNotificationListener();
    } else {
      await OneSignal.Notifications.requestPermission(true).then((accepted) async {
        if (accepted) {
          await _registerNotificationListener();
        }
      });
    }
  }

Future<void> _registerNotificationListener() async {
  //enable push notification after login
  await OneSignal.User.pushSubscription.optIn();
 
OneSignal.Notifications.addForegroundWillDisplayListener(_getForegroundNotifDisplayListener);
    OneSignal.Notifications.addClickListener(_getOnClickNotifListener);
  }

What did you expect to happen?

I expected to show icon badges on my apps when receive notifications.

OneSignal Flutter SDK version

flutter 3.27.3

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions