react-native-fcm icon indicating copy to clipboard operation
react-native-fcm copied to clipboard

Local notification is not called in Android

Open elad823 opened this issue 6 years ago • 2 comments

Before openning an issue

  1. Reproduce it with the example project in this repo.
  2. If you can't receive iOS notification, make sure you can receive notification using quickstart-ios project provided by Firebase team

When openning an issue, please include following information for better support

  1. What version of RN and react-native-fcm are you running?
  2. What device are you using? (e.g iOS9 emulator, Android 6 device)?
  3. Is your app running in foreground, background or not running?

elad823 avatar Jan 18 '19 12:01 elad823

When I call presentLocalNotification in Android, No notfication is displayed, and FCM.on(FCMEvent.Notification , receivedNotification) is not called either. Not in background and not in Foregroud.

(When I sending remote notification, notfication is displayed but FCM.on(FCMEvent.Notification , receivedNotification) is not called)

FCM.presentLocalNotification({
       title: "Test Notification",
       body: "Test Notification Body",
       priority: "high",
       show_in_foreground: true})

AndroidMainifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.travelmaker"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />



    <uses-sdk android:targetSdkVersion="22" />

    <application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:theme="@style/AppTheme">
      <receiver android:name="com.evollu.react.fcm.FIRLocalMessagingPublisher"/>
      <receiver android:enabled="true" android:exported="true"  android:name="com.evollu.react.fcm.FIRSystemBootEventReceiver">
          <intent-filter>
              <action android:name="android.intent.action.BOOT_COMPLETED"/>
              <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
              <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
              <category android:name="android.intent.category.DEFAULT" />
          </intent-filter>
      </receiver>



      <!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
           See README(https://goo.gl/l4GJaQ) for more.
      <meta-data
          android:name="com.google.firebase.messaging.default_notification_icon"
          android:resource="@drawable/ic_stat_ic_notification" />-->

      <!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
           notification message. See README(https://goo.gl/6BKBk7) for more.
      <meta-data
          android:name="com.google.firebase.messaging.default_notification_color"
          android:resource="@color/colorAccent" />-->

        <!--If you prefer to create and use your own default channel,
            set default_notification_channel_id to the ID of your notification channel object as shown;
            FCM will use this value whenever incoming messages do not explicitly set a notification channel.

        <meta-data
              android:name="com.google.firebase.messaging.default_notification_channel_id"
              android:value="my_default_channel"/>
         !-->

           <service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true">
             <intent-filter>
               <action android:name="com.google.firebase.MESSAGING_EVENT"/>
             </intent-filter>
           </service>

           <service android:name="com.evollu.react.fcm.InstanceIdService" android:exported="false">
            <intent-filter>
               <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
             </intent-filter>
           </service>
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:launchMode="singleTop"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
    </application>

</manifest>

elad823 avatar Jan 18 '19 12:01 elad823

@elad823 Did you manage to solve this problem ?

Udbhav12 avatar Aug 13 '19 07:08 Udbhav12