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

AppboyBroadcastReceiver#onReceive is not called on Android 7.0 #64

Closed
zelongg opened this issue Nov 23, 2016 · 15 comments
Closed

AppboyBroadcastReceiver#onReceive is not called on Android 7.0 #64

zelongg opened this issue Nov 23, 2016 · 15 comments

Comments

@zelongg
Copy link

zelongg commented Nov 23, 2016

RESULT="$(curl --silent -X POST -H "Content-Type: application/json" \
  -d "{\"app_group_id\":\"$APP_GROUP_ID\",\"external_user_ids\":[\"$USER_ID\"],\"messages\":{ \
  \"android_push\":{\"title\":\"$TITLE\",\"alert\":\"$MESSAGE\",\"custom_uri\":\"$DEEP_LINK\" ,\"extra\":{\"$EXTRA_KEY1\":\"$EXTRA_VALUE1\", \"$EXTRA_KEY2\":\"$EXTRA_VALUE2\", \"$EXTRA_KEY3\":\"$EXTRA_VALUE3\", \"$EXTRA_KEY4\":\"$EXTRA_VALUE4\"}} \
  }}" \
  https://api.appboy.com/messages/send)"

if [ ! "$RESULT" = "{\"message\":\"success\"}" ]; then
   echo "Failed to send message: $RESULT"
   exit 1
fi

if [ "$RESULT" = "{\"message\":\"success\"}" ]; then
   echo "Succeed to send message"
fi

AppboyBroadcastReceiver#onReceive is not called.

The Same script can work on Nexus 5 Android 6.0.1 but not work on Nexus 6 Android 7.0

@briancaw
Copy link
Contributor

Hi @Gongzelong

Thanks for reporting this. Unfortunately we're unable to reproduce any AppboyBroadcastReceiver breaking change in Android 7.0.

Can you confirm that:

  • in the Appboy dashboard your Android 7.0 user is marked as push enabled
  • to debug this scenario, you are using different users on both devices

Can you also test sending via our dashboard (sending a campaign to one user), and confirm:

  • the campaign statistics show 1 send, 0 bounces
  • if you see any bounces or failures, please reference the message error log in the developer console

Thanks,
Brian

@zelongg
Copy link
Author

zelongg commented Nov 24, 2016

@briancaw

Thanks for helping me.

Can you confirm that:

in the Appboy dashboard your Android 7.0 user is marked as push enabled
to debug this scenario, you are using different users on both devices

I used "User Search" to see what is the difference.

Is the issue because the Nexus 6 is Push Registered For nothing?

Could you tell me how to do Push Registered?
screen shot 2016-11-24 at 6 05 11 pm
screen shot 2016-11-24 at 6 11 23 pm

@briancaw
Copy link
Contributor

Hi @Gongzelong

Push registration happens when we get a valid push token from FCM/GCM. That can happen when either:

  • You pass us a push token via registerAppboyPushMessages(registrationId)
  • You allow us to automatically register for push

Can you let us know which version of push registration you are using? For reference, our push docs are here. Can you also let us know if you are using FCM or GCM-style push registration?

Regarding why one device wouldn't register for push and another would - is there anything different in the builds across the two devices? Is the Android N device an emulator?

Thanks,
Brian

@zelongg
Copy link
Author

zelongg commented Nov 28, 2016

@briancaw

Can you let us know which version of push registration you are using?

I think we pass us a push token via registerAppboyPushMessages(registrationId).

private final GcmManager.Client mGcmClient = new GcmManager.Client() {
        @Override
        public void onNewToken(String newToken, String oldToken) {
            mAppboy.registerAppboyPushMessages(newToken);
        }
    };

Can you also let us know if you are using FCM or GCM-style push registration?

GCM-style push registration

Regarding why one device wouldn't register for push and another would - is there anything different in the builds across the two devices?

Haven't seen any difference between the apk on Nexus 5 Android 6.0.1 and Nexus 6 Android 7.0

Is the Android N device an emulator?

No, it is the real phone.

@zelongg
Copy link
Author

zelongg commented Nov 28, 2016

Can you confirm that:

  • in the Appboy dashboard your Android 7.0 user is marked as push enabled
  • to debug this scenario, you are using different users on both devices

in the Appboy dashboard your Android 7.0 user is marked as push enabled

How to confirm that?

to debug this scenario, you are using different users on both devices

What do you mean?

Can you also test sending via our dashboard (sending a campaign to one user), and confirm:

  • the campaign statistics show 1 send, 0 bounces
  • if you see any bounces or failures, please reference the message error log in the developer console

the campaign statistics show 1 send, 0 bounces. This can be confirmed.

if you see any bounces or failures, please reference the message error log in the developer console

There seems to be no bounces.

screen shot 2016-11-28 at 11 57 54 am

@briancaw
Copy link
Contributor

briancaw commented Nov 28, 2016

Hi @Gongzelong

Thanks for that info. For the campaign that you sent from our dashboard, are you confirming that you didn't see that push hit the onReceive in your AppboyBroadcastReceiver?

That user is push enabled and it looks like it sent to the device. If that all worked but you're still not seeing your BroadcastReceiver get called, can you please let us know:

  • What version of the SDK are you using?
  • How are you declaring the AppboyBroadcastReceiver in your AndroidManifest?
  • Can you also send a message with a title/message and confirm it displays when you send it?

Thanks,
Brian

@zelongg
Copy link
Author

zelongg commented Nov 29, 2016

How are you declaring the AppboyBroadcastReceiver in your AndroidManifest?

Since the other phone can get push notification, it it sure that I declared the AppboyBroadcastReceiver in our AndroidManifest.

What version of the SDK are you using?

Our project includes the source code. And the OurProject/third_party/appboy/build.gradle shows:

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }

Can you also send a message with a title/message and confirm it displays when you send it?

What do you mean?

@briancaw
Copy link
Contributor

Hi @Gongzelong

  • For "Can you also send a message with a title/message" - I looked at the campaign you sent and it didn't have a title or message and what I wanted to see was signal if the push ever got to the device at all. Sending the push with a title and message would make it show up in the UI if things were working and should be clear signal that the push got to the device.
  • For SDK version: even though you are using source, can you let us know what version of our SDK you got the source from?
  • Because you have the source, can you put a breakpoint on our AppboyGcmReceiver's onReceive and see if that code is being executed when a push arrives?

What we're trying to figure out here is whether or not the push is actually being delivered to the device at all. In the functionality from send to the onReceive of your custom receiver there's a few main places we'll want to see if functionality is working to help narrow the cause of the error. Namely:

  • The payload is sent to the GCM server; this is why we checked the push enabled status and checked the sent count in the dashboard
  • The payload arrives in our system; this is why we want to check if the AppboyGCMReceiver's onReceive is being called.
  • Our AppboyGCMReceiver fires the receipt intent here or here. If we find that our AppboyGCMReciever's onRecieve is being called but your receiver isn't, you can also step debug through the few lines between our onReceive and those intent broadcasts to see if we are sending the intent.

Please let me know if this information helps narrow the cause of this issue.

Thanks,
Brian

@zelongg
Copy link
Author

zelongg commented Dec 2, 2016

For "Can you also send a message with a title/message" - I looked at the campaign you sent and it didn't have a title or message and what I wanted to see was signal if the push ever got to the device at all. Sending the push with a title and message would make it show up in the UI if things were working and should be clear signal that the push got to the device.

I remembered I sent with a title and message? How did you look at the campaign? Where shows it didn't have a title or message?

For SDK version: even though you are using source, can you let us know what version of our SDK you got the source from?

SDK version is v1.11.0

public final class AppboyGcmReceiver extends BroadcastReceiver {
  private static final String TAG = String.format("%s.%s", Constants.APPBOY_LOG_TAG_PREFIX, AppboyGcmReceiver.class.getName());

public final class Constants {
    public static final String APPBOY_LOG_TAG_PREFIX = String.format("%s v%s ", new Object[]{"Appboy", "1.11.0"});
    public static final String APPBOY = "Appboy";
    public static final String APPBOY_SDK_VERSION = "1.11.0";

I re-test the whole thing. And it is kinda different than before.
Here is the current situation.

When I installed the app, it will trigger the code below.

private final GcmManager.Client mGcmClient = new GcmManager.Client() {
        @Override
        public void onNewToken(String newToken, String oldToken) {
            mAppboy.registerAppboyPushMessages(newToken);
        }
    };

I think this is for registering the push for our app.
But there is something wrong.

I can find the user in User Search, but it shows Push Registered For No Apps.

When I created a campaign both in script and in dashboard.

There are no results when I adb logcat | grep Appboy

The only log I got is

10-01 21:30:29.495 16712 16712 I art     : Rejecting re-init on previously-failed class java.lang.Class<com.appboy.services.AppboyWearableListenerService>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/wearable/WearableListenerService;
10-01 21:30:29.496 16712 16712 I art     :   at void com.appboy.Appboy.<init>(android.content.Context) (SourceFile:238)
10-01 21:30:29.496 16712 16712 I art     :   at com.appboy.Appboy com.appboy.Appboy.getInstance(android.content.Context) (SourceFile:155)
10-01 21:30:29.496 16712 16712 I art     :   at void com.opera.android.news.analytics.AppboyManager.<init>(android.app.Application, com.opera.android.news.settings.SettingsManager) (AppboyManager.java:53)
10-01 21:30:29.496 16712 16712 I art     :   at void com.opera.android.news.analytics.AppboyReporter.<init>(android.app.Application, com.opera.android.news.settings.SettingsManager, com.opera.android.gcm.GcmManager) (AppboyReporter.java:23)
10-01 21:30:29.496 16712 16712 I art     :   at void com.appboy.Appboy.<init>(android.content.Context) (SourceFile:238)
10-01 21:30:29.496 16712 16712 I art     :   at com.appboy.Appboy com.appboy.Appboy.getInstance(android.content.Context) (SourceFile:155)
10-01 21:30:29.496 16712 16712 I art     :   at void com.opera.android.news.analytics.AppboyManager.<init>(android.app.Application, com.opera.android.news.settings.SettingsManager) (AppboyManager.java:53)
10-01 21:30:29.496 16712 16712 I art     :   at void com.opera.android.news.analytics.AppboyReporter.<init>(android.app.Application, com.opera.android.news.settings.SettingsManager, com.opera.android.gcm.GcmManager) (AppboyReporter.java:23)

I test them both on Nexus 6 and HTC One S Z560e.

screen shot 2016-12-02 at 3 08 36 pm

screen shot 2016-12-02 at 3 08 46 pm

screen shot 2016-12-02 at 3 08 13 pm

screen shot 2016-12-02 at 3 07 42 pm

Because you have the source, can you put a breakpoint on our AppboyGcmReceiver's onReceive and see if that code is being executed when a push arrives?
What we're trying to figure out here is whether or not the push is actually being delivered to the device at all. In the functionality from send to the onReceive of your custom receiver there's a few main places we'll want to see if functionality is working to help narrow the cause of the error. Namely:

The payload is sent to the GCM server; this is why we checked the push enabled status and checked the sent count in the dashboard
The payload arrives in our system; this is why we want to check if the AppboyGCMReceiver's onReceive is being called.
Our AppboyGCMReceiver fires the receipt intent here or here. If we find that our AppboyGCMReciever's onRecieve is being called but your receiver isn't, you can also step debug through the few lines between our onReceive and those intent broadcasts to see if we are sending the intent.

Regarding this part you said, since the log of Appboy shows nothing, I think the AppboyGCMReceiver's onReceive is not called.

The Server seems not have sent the push.

Maybe it is a new issue. But since I tested in two devices. Could you help me debug that?

I am not sure whether the cause of the original one is the same as this new one.

Is there some way to narrow the cause of the error?

Is the below shown in the log a great cause:

Rejecting re-init on previously-failed class java.lang.Class<com.appboy.services.AppboyWearableListenerService>?

@briancaw
Copy link
Contributor

briancaw commented Dec 4, 2016

Hi @Gongzelong

For the no-title/no-message push, I was looking at the 'gongzelong-test*' campaigns. I see that you have other campaigns with title/message so that should be fine; it's important though to test with campaigns that have title/message to narrow the scope of the issue.

The rejecting re-init log statement should just be noise for this issue. We'll be aiming to remove that in one of our next releases.

For push not registering - I'm currently seeing the user your screenshotted as push enabled; there is a possible delay (on the order of seconds) between calling registerAppboyPushMessages and your user appearing push enabled in our dashboard. Our release next week will add functionality that should bring that possible delay down significantly. To mitigate that issue right now you can call requestImmediateDataFlush after you call registerAppboyPushMessages.

Now that your user is push enabled, can you test again?

Thanks,
Brian

screen shot 2016-12-04 at 11 13 30 am

@JhoareAppboy
Copy link

Hi @Gongzelong,

My name is James and I'm Opera's Customer Success Manager in Appboy's London Office. If you continue to see issues delivering this push please feel free to contact me directly at james.hoare@appboy.com

We can pick up the case and indeed arrange a video call if that would be helpful.

Thanks and kind regards
James

@briancaw
Copy link
Contributor

Hi @Gongzelong

Just following up on this. Please let us know you were able to solve the issues you were seeing. We've still been unable to reproduce this on our end.

Thanks,
Brian

@zelongg
Copy link
Author

zelongg commented Dec 20, 2016

Hi, @briancaw @JhoareAppboy

Sorry for being too busy to update the status.

Thanks for your help.

My workmate dealt with that and he said it is now Okay.

I will find time to see what he did and figure out what has happened.

I will update here to let you know.

Thanks for your guys' help again.

@JhoareAppboy
Copy link

Hi @Gongzelong

Great to hear you guys got this working. Please do reach out if there is anything else we can help out with

Thanks
James

@gongzelong0718
Copy link

Marked

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