首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法接收moengage推送通知

无法接收moengage推送通知
EN

Stack Overflow用户
提问于 2021-09-01 16:26:00
回答 1查看 184关注 0票数 0

我已经通过了moengage flutter的文档,但无法收到通知,我已经添加了仪表板的FCM键也。下面在我的实现中,当我通过fcm发送通知时,工作正常,基本上我们有两种模式,颤动,apk,prod和debug,我正在调试,我已经在moengage仪表板中添加了debug包名。当我创建活动并向所有android用户发送推送时,它不工作。请帮帮忙

Application.kt类

代码语言:javascript
复制
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.GeneratedPluginRegistrant


import com.moengage.core.LogLevel
import com.moengage.core.MoEngage
import com.moengage.core.MoEngage.Builder
import com.moengage.core.config.FcmConfig
import com.moengage.core.config.LogConfig
import com.moengage.core.config.MiPushConfig
import com.moengage.core.config.PushKitConfig
import com.moengage.core.config.NotificationConfig
import com.moengage.flutter.MoEInitializer
import com.moengage.pushbase.MoEPushHelper
import io.flutter.app.FlutterApplication

class Application : FlutterApplication(), PluginRegistrantCallback {
    override fun onCreate() {
        super.onCreate()
        val moEngage = MoEngage.Builder(this, "hereIHaveAddedTheKey")
                .build()
        MoEngage.initialise(moEngage)
    }

    override fun registerWith(registry: PluginRegistry?) {
        if (registry == null) return
    }
}

Build.gradle依赖

代码语言:javascript
复制
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.android.support:multidex:1.0.3'
    /// ---- moengage sdk start----
    implementation("com.moengage:moe-android-sdk:11.2.00")
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation("com.google.firebase:firebase-messaging:20.3.0")
    implementation("androidx.lifecycle:lifecycle-process:2.2.0")
    implementation("com.moengage:hms-pushkit:2.0.01")
    implementation("com.moengage:rich-notification:2.2.00")
    implementation("androidx.core:core:1.3.1")
    implementation("androidx.appcompat:appcompat:1.2.0")
    /// --- end ----
}

应用程序-> build.gradle

代码语言:javascript
复制
buildscript {
    ext.kotlin_version = '1.5.21'
    repositories {
        google()
        jcenter()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.5'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是颤动运动的初始化

代码语言:javascript
复制
 final MoEngageFlutter _moengagePlugin = MoEngageFlutter();

  void initialise() {
    _moengagePlugin.initialise();
  }

  void initState() {
    super.initState();
    initialise();
  }

mainefestFile

代码语言:javascript
复制
<service android:name="com.moengage.firebase.MoEFireBaseMessagingService">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>
EN

回答 1

Stack Overflow用户

发布于 2021-09-01 17:59:17

您需要添加显示推流通知所需的元数据,并使用提供的API将负载传递给SDK。请参阅此处的文档- https://docs.moengage.com/docs/push-configuration

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69017513

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档