OneSignal-Flutter-SDK icon indicating copy to clipboard operation
OneSignal-Flutter-SDK copied to clipboard

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

Open caini1213 opened this issue 6 months ago • 0 comments

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
  • [x] Android

Relevant log output


Code of Conduct

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

caini1213 avatar May 02 '25 08:05 caini1213