androidnotificationshuawei-mobile-serviceshuawei-developershuawei-push-notification

Unable to get Notifications on Huawei devices with HmsMessageService (HMS push kit)


I am using HMS push kit to get notification. Notifications were working fine about 1 week ago, but now when I re run that code, it is not working. I cross checked all the things but unable to find anything. Dependency which I am using is:

implementation 'com.huawei.hms:push:5.1.1.301'

I have added agconnect-services.json too in my project. Also added app id in manifest. SHA-256 key is also fine.

Code to receive notifications is:

public class HMSMessageService extends HmsMessageService {

@Override
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
    
    }
}

I have also added the tag of this service in manifest file.

I also tried with HMS toolkit (Coding assistant in android studio), sending notification from there is successful but I am not getting it on app.

enter image description here

To view Logcat Logs, click here


Solution

  • It was due to some backend issues. Due to security reasons there were some checks (IP was blocked) due to which I was unable to get notifications. (But it is strange that due to that backend checks, only HMS notifications were blocked, not firebase notifications)