evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 682 forks source link

Android - Local notifications not trigger after restart #459

Open jaimecorrea opened 7 years ago

jaimecorrea commented 7 years ago

I'm not checking this repo every day since it is fairly stable now. If you have found a bug or need immediate attention please [AT]me

Please include following information for better support

What version of RN and react-native-fcm are you running? "react-native": "0.45.1", "react-native-fcm": "^6.2.3", What device are you using? (e.g iOS9 emulator, Android 6 device)? Android Device Is your app running in foreground, background or not running? All

I can see the list of notifications after restart the device, but they don't trigger at the fire_date it should...

AndroidManifest.xml

...

<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

... 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>

... <activity android:name=".MainActivity" android:label="@string/app_name" android:launchMode="singleTask" android:configChanges="keyboard|keyboardHidden|orientation|screenSize">

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

    <intent-filter>
      <action android:name="ACTION" />
      <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>

...

  <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>
jaimecorrea commented 7 years ago

@EdmundMai what should be the targetSDKVersion?

defaultConfig { minSdkVersion 16 targetSdkVersion 22 versionCode 30 versionName "0.1.22" ndk { abiFilters "armeabi-v7a", "x86" } multiDexEnabled = true }

Kabangi commented 6 years ago

Am experiencing this issue too. Any idea how to go around this?

@jaimecorrea Did you figure it out?

evollu commented 6 years ago

what brand is your device? some brand of android devices requires you to grant permissions in settings