Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23720] Android - CallBack for push notifications doesn't work when app is open in background

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2016-12-22T15:41:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, ipass1
ReporterDavide Pecis
AssigneeGary Mathews
Created2016-07-30T14:16:19.000+0000
Updated2018-08-06T17:37:06.000+0000

Description

Hello, I’m having a problem with push notifications in the Android version of the App we are developing. Specifically, it seems like push notifications work differently if my app has been sent to background using the “back” or “home” button of the phone. *1) FIRST CASE – background using back button* When I receive a push notification, I click on it, the App opens and display the right page *2) SECOND CASE - background using home button* This time, when I receive a push notification and click on it, the App opens on the last page I was previously viewing, before I sent the app to background. This is obviously not the right behavior. It seems like the CallBack function for push notification is not called in this case; we are using Single Call Back. Now, the interesting thing is that if I open the App again immediately, now the callback works and the first thing I see in the App is the content of the push notification. --- We are using SingleCallback. This bug is on Android only; on iOS devices everything is ok. Our code: if (isAndroid) { var CloudPush = require('ti.cloudpush'); CloudPush.setSingleCallback(true); CloudPush.retrieveDeviceToken({ success: deviceTokenSuccess, error: deviceTokenError }); CloudPush.addEventListener('callback', pushCallbackAll); } --- I've also made a short video to let you see what happens: https://youtu.be/hiYwcY3vahY Why does it happen? Any idea? Thank you very much for your help, Kind regards Davide

Comments

  1. Davide Pecis 2016-08-22

    Any update about this issue? Thank you for your help, Regards
  2. Davide Pecis 2016-09-07

    Sorry to bother you, but more than a month has passed without any answer. Have you been able to reproduce it? Is there any update? If you need more information, please, just ask me. Kind regards Davide
  3. Davide Pecis 2016-11-08

    Hello, Has this bug been resolved with the latest releases of Studio 4.8.0 and Titanium 6.0.0? Please, any feedback about it would be highly appreciated. You haven't given a single reply so far... Best Davide
  4. Lokesh Choudhary 2016-11-10

    [~Peach1200], I am not able to reproduce the issue with a simple callback like an alert & setSingleCallback true . Can you provide me with a sample with which I can reproduce the issue?
  5. Gary Mathews 2016-11-11

    [~Peach1200] I'm curious as to what you are doing inside your pushCallbackAll() method? How are you creating the Intent to open the specific page you want?
  6. Gary Mathews 2016-12-22

    The intent to open the app should use the Ti.Android.FLAG_ACTIVITY_NEW_TASK intent. Closing as invalid.
  7. Davide Pecis 2017-02-20

    Hello @Gary Mathews Sorry for my late reply. I've heard from my developer today about this issue. He told me that we use the following module: Modules.CloudPush If I'm not mistaken, we don't have direct access to the intent inside the module. Am I mistaken? How can we eventually check and change the intent used in that module? (sorry for my poor "technical language"; my developer does not speak english and I'm trying to translate what he says to me) Thank you for your help, Best regards Davide
  8. Eric Merriman 2018-08-06

    Closing as invalid. If incorrect, please reopen.

JSON Source