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

GCM-DMM : broadcast intent callback: result=CANCELLED #834

Closed
wmonecke opened this issue Mar 5, 2018 · 14 comments
Closed

GCM-DMM : broadcast intent callback: result=CANCELLED #834

wmonecke opened this issue Mar 5, 2018 · 14 comments

Comments

@wmonecke
Copy link

wmonecke commented Mar 5, 2018

I can receive FCM Remote push notification when I boot my phone and actually open the app. I receive the notifications if the app is in the foreground or background as expected. However, I expect to also receive the push notifications if the user has not yet opened the app. I do not receive these notifications, in other words, when the app is killed or has not yet been opened.

In my logcat I see the following error:

GCM-DMM : broadcast intent callback: result=CANCELLED forIntent
{ act=com.google.android.c2dm.intent.RECEIVE flg=0x10000000 pkg=com.lisdo (has extras) }

After googling I came across this question.

It suggests, that in the AndroidManifest.xml something is missing to register these FCM events, but I thought the steps in the READ.ME would cover this scenario.

Any ideas??

I am running on an actual android device for testing (Xiaomi Mi Mix) and I do receive remote PN from other apps (WhatsApp, etc.).

"react-native": "^0.47.1",
"react-native-fcm": "^13.3.3",
@evollu
Copy link
Owner

evollu commented Mar 5, 2018

xiaomi has app notification permission in its setting, make sure you turn that on.
it whitelist some popular apps as whatsapp and facebook automatically

@wmonecke
Copy link
Author

wmonecke commented Mar 5, 2018

@evollu I have all permission granted for my app and it still isnt working. Any other idea?

@evollu
Copy link
Owner

evollu commented Mar 6, 2018

can you reproduce it with example app?

@wmonecke
Copy link
Author

wmonecke commented Mar 6, 2018

Yes, Ill try to do it.

Are you using C2DM in react-native-fcm?

Here is my AndroidManifest if you notice anything weird:

Thank you for your help! :)

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

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <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.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

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

    <application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:largeHeap="true"
      android:launchMode="singleInstance"
      android:theme="@style/AppTheme">
      <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id"
      />
      <meta-data
        android:name="com.google.android.geo.apikey"
		    android:value="apikey"
      />
      
      <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notif"/>
      <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>

      <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:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

@evollu
Copy link
Owner

evollu commented Mar 6, 2018

seems right to me.
also try to reproduce in android emulator

@wmonecke
Copy link
Author

wmonecke commented Mar 6, 2018

@evollu I just tried it on a google pixel in the emulator and it works fine.

Seems to be an issue with phones running MIUI.

Thank you for your time!!

@edy
Copy link

edy commented Mar 13, 2018

I have the same error on my Nexus 5X. I'll try to debug this somehow..

@evollu evollu closed this as completed Mar 13, 2018
@judemanutd
Copy link

@wmonecke it's a problem with autostart I think, this permission is different from the app permissions. I created a library exactly for this Autostarter.
You can take a look at its description which gives you a quick summary of what exactly your're facing.

This issue only occurs on non stock android phones.

@KORuL
Copy link

KORuL commented Mar 2, 2019

I have this problem on Meizu m1 note

@KORuL
Copy link

KORuL commented Mar 2, 2019

@judemanutd is This help you? Any solution for Meizu?

@Xing1P
Copy link

Xing1P commented Mar 26, 2019

try this

<permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />

@KORuL
Copy link

KORuL commented Mar 26, 2019

@pahnpiseth what this? Where is answer?

@Xing1P
Copy link

Xing1P commented Mar 26, 2019

@KORuL i'm edited.

@lyseiha
Copy link

lyseiha commented Nov 2, 2019

@pahnpiseth Wow Thank you so much. you help me a lot. i stuck for a week for that problem with oppo android o.

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

7 participants