Huawei Push Notifications

469 Views Asked by At

I'm trying to implement push notification, since Hauwei does not support Firebase / Azure Notification Hubs.

As I have it at the moment, I will have a singleton class that is injected during startup that will deal the receipt of the messages and broadcast it into the application with the weakEventManager of mvvm(I prever this pattern), but the issue is to get Hauwei wired up from a platform perspective. I do not want Hauwei libraries in the normal build and do not want google services libraries in Hauwei build. (Nice compiler directive delivery)

Does anyone know how I can achieve this?

1

There are 1 best solutions below

2
On

You can achieve this by adding some logic in build.gradle.

// Define the store to build for in build.gradle
ext.store = 'huawei' // For normal google build can change to google

def isHmsBuild() {
    return project.property('store') == "huawei"
}

if(isHmsBuild()) {
    // Add dependencies or any configuration related HMS
}