Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25022] Android : CloudPush Callback didnt fire after open a new window in Alloy

GitHub Issuen/a
TypeBug
Priorityn/a
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 6.0.3
Fix Version/sn/a
Componentsn/a
Labelsandroid, engSchedule, pushnotification
ReporterYellowcube
AssigneeUnknown
Created2017-03-28T02:35:28.000+0000
Updated2019-10-17T07:10:03.000+0000

Description

The CloudPush Callback is not working after the app open a new window. Ti.Cloud Modules Version : 3.2.11 Ti.Cloudpush Modules Version: 4.0.3 Ti.SDK Version : 6.0.3 GA The CloudPush Callback only fired when i first launched the app and didn't open a new window whenever a new notifications come in. That means it will not fire anymore if i open a second window and a new notification come in. But, the callback will show the previous notification which didn't show in the second window after i kill the app and relaunch it. Besides that, the CloudPush trayClickLaunchedApp and trayClickFocusedApp EventListener not working also. There are some Warning showed in the console when i stayed in second window and receive a new notification come in as the screenshort attached. Sample code of my project: ----------------------------------------------------------------------------------------------------------------------------- alloy.js var CloudPush = require('ti.cloudpush'); CloudPush.debug = true; CloudPush.enabled = true; CloudPush.showTrayNotificationsWhenFocused = true; CloudPush.showTrayNotification = true; CloudPush.focusAppOnPush = false; var deviceToken = null; var Cloud = require('ti.cloud'); Cloud.debug = true; CloudPush.retrieveDeviceToken({ success: deviceTokenSuccess, error: deviceTokenError }); function deviceTokenSuccess(e) { deviceToken = e.deviceToken; loginDefault(); } function deviceTokenError(e) { console.log('Failed to register for push notifications! ' + e.error); alert('Failed to register for push notifications! ' + e.error); } function loginDefault(e) { Cloud.Users.login({ login: 'test@gmail.com', password: 'TESTabc123' }, function (e) { if (e.success) { defaultSubscribe(); // alert("Successfully Loged In"); } else { // alert('Error login-----: ' + ((e.error && e.message) || JSON.stringify(e))); } }); } function defaultSubscribe() { Cloud.PushNotifications.subscribe({ channel: 'test1', device_token: deviceToken, type: 'android' }, function (e) { if (e.success) { alert('Device Subscribed!'); } else { alert('Error defaultSubscribe : ' + ((e.error && e.message) || JSON.stringify(e))); } }); } CloudPush.addEventListener('callback', function (evt) { alert("Notification received: " + evt.payload); }); CloudPush.addEventListener('trayClickLaunchedApp', function (evt) { Ti.API.info('Tray Click Launched App (app was not running)'); }); CloudPush.addEventListener('trayClickFocusedApp', function (evt) { Ti.API.info('Tray Click Focused App (app was already running)'); }); ----------------------------------------------------------------------------------------------------------------------------- index.js $.index.open(); function NEWWIN(e){ Alloy.createController("Newwin").getView().open(); $.index.close(); } ----------------------------------------------------------------------------------------------------------------------------- index.xml ----------------------------------------------------------------------------------------------------------------------------- Newwin.js var args = $.args; function BACKUPINDEX(e){ Alloy.createController("index").getView().open(); $.container.close(); } ----------------------------------------------------------------------------------------------------------------------------- Newwin.xml -----------------------------------------------------------------------------------------------------------------------------

Attachments

FileDateSize
Screenshot_20170328-100456.png2017-03-28T02:34:59.000+000034125
Screenshot_20170328-101559.png2017-03-28T02:34:50.000+000023349
Screenshot_20170328-101602.png2017-03-28T02:34:52.000+000018606
Screenshot_20170328-101605.png2017-03-28T02:35:02.000+000018923
Screenshot 2017-03-28 10.21.37.png2017-03-28T02:35:06.000+0000353589

Comments

  1. Sharif AbuDarda 2017-03-29

    Hello, Please attach an app folder in here. With your sample code I end up with the [INFO] [app.js] Titanium entry point processing... [ERROR] [ERROR] Alloy compiler failed Thanks.
  2. Gabriel Gallardo 2017-07-26

    The problem occurs at the time of closing the window from which it subscribes to push notifications, Titanium should persist CloudPush even when you close the window from which it was instantiated, please provide a solution for that problem...
  3. Riduanul Islam 2019-08-20

    Is there any progress for this issue? It's being long so we can update to customer. Thank you.

JSON Source