Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push notification not working with firebase_messaging plugin #20

Closed
thangvq95 opened this issue Dec 19, 2020 · 5 comments
Closed

Push notification not working with firebase_messaging plugin #20

thangvq95 opened this issue Dec 19, 2020 · 5 comments

Comments

@thangvq95
Copy link

Hi,
I'm using firebase_messaging 7.0.3 version.
I'm following the documents for push notification: https://docs.kommunicate.io/docs/flutter-pushnotification. (Added the FCM key to dashboard already). But seem like kommunicate plugin doesn't work with firebase_messaging.

Best,

@Samir1810
Copy link
Contributor

Hi,

Please sent App_ID, Application key - You'll get from https://dashboard.kommunicate.io/settings/install and the User_ID of the receiver to [email protected] with the issue details. We can test and update you.

@thangvq95
Copy link
Author

thangvq95 commented Dec 21, 2020 via email

@Samir1810
Copy link
Contributor

Okay. We'll check and update you via email.

@CripyIce
Copy link

Hi,
Same here.
In your docs there are 2 logs that should be called once the function works, but none of them are called.

KmFirebaseMessagingService.java - location: my_app/android/app/src/main/java/io/pushnotification/KmFirebaseMessagingService.java:

package io.pushnotification;

import com.applozic.mobicommons.commons.core.utils.Utils;
import com.google.firebase.messaging.RemoteMessage;

import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
import io.kommunicate.Kommunicate;

public class KmFirebaseMessagingService extends FlutterFirebaseMessagingService {

  private static final String TAG = "KmFCMService";

  @Override
  public void onNewToken(String s) {
    Utils.printLog(this, TAG, "Found deviceToken in KM : " + s);
    super.onNewToken(s);
    Kommunicate.updateDeviceToken(this, s);
  }

  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
    Utils.printLog(this, TAG, "Kommunicate notification processing...");
    if (Kommunicate.isKmNotification(this, remoteMessage.getData())) {
      return;
    }
    super.onMessageReceived(remoteMessage);
  }
}

AndroidManifest.xml:

<application
        android:icon="@mipmap/launcher_icon"
        android:label="SDO"
        tools:replace="android:label">
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name="com.my.company.MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
                android:name="io.flutter.embedding.android.NormalTheme"
                android:resource="@style/NormalTheme" />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
                android:name="io.flutter.embedding.android.SplashScreenDrawable"
                android:resource="@drawable/launch_background" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

        <service
            android:name="io.pushnotification.KmFirebaseMessagingService"
            android:exported="true"
            android:stopWithTask="false"
            tools:node="replace">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

        <service
            android:name="io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService"
            tools:node="remove" />
    </application>

Flutter version: 1.22.6

pubspec.yaml:

firebase_messaging: 7.0.3
kommunicate_flutter: 1.1.6

@Samir1810
Copy link
Contributor

Hi,
Please sent App_ID, Application key - You'll get from https://dashboard.kommunicate.io/settings/install and the User_ID of the receiver to [email protected] with the issue details. We can test and update you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants