4

I am using Urban Airship on Android to receive notifications. The Appcelerator Module IS QUITE OLD (3 years ago) https://github.com/appcelerator-modules/ti.urbanairship and I'm using this fork: https://github.com/rdking/ti.urbanairship/tree/master/android.

With rdking version I'm able to get notifications on Android 5, but only when the app is opened (foreground). If I open another app or close it (put it on background), it will not get it.

I'm using Titanium SDK 5.1.2.GA (both app and module), building the module with NDK r10e and

platforms/android-13 and add-ons/addon-google_apis-google-13

(Not sure which version I should use and if is something wrong on it.)

I think I'm missing maybe some configuration on Android Manifest. Notifications are working perfectly on Android < 4 and iOS.

Thanks in advance =)

Carlos Zinato
  • 591
  • 7
  • 19
  • What do you mean by not receiving the notificaiton when the app is backgrounded? Does the notification still display in the notification center? Or are you not getting notified of the push? – ralepinski Mar 29 '16 at 16:53
  • I'm not getting notified at all =/ – Carlos Zinato Mar 30 '16 at 08:28
  • Do you see any useful error messages when the push comes in? Does UA log the push received? I am not that familiar with titanium but I might be able to help patch the module. – ralepinski Mar 30 '16 at 17:27
  • I did some progress on it yesterday. If the app is running on background, the module receive the notification (I have a log for it) but it is not been displayed on device's notification center. The problem is when the app is closed. If the app is closed, I'm not receiving the notification at all =/ – Carlos Zinato Mar 31 '16 at 09:16
  • 1
    I think it has to do where the modules get initialized. Urban Airship needs to initialized during the Application.oncreate so its ready when a push is received. I have no idea how this would only happen on Android 5+. It looks like it will be difficult trying to hook takeoff in the Application, so I would recommend Autopilot instead. Example - https://github.com/urbanairship/phonegap-ua-push/blob/master/src/android/CordovaAutopilot.java. – ralepinski Mar 31 '16 at 16:04

3 Answers3

1

I recently talked with a rep at UA and they advised me they no longer officially support Titanium. I am using 5.2.0GA to run on Android M devices and UA does not work on all. I am currently in the process of switching to Appcelerator's Arrow system for notifications. So far it is running smoothly. They use their own module called Ti.CloudPush for android. I would recommend checking it out.

  • 1
    I know that Urban Airshit is not supporting Titanium anymore, but don't know why Titanium is not supporting UA if you know what I mean. I want to switch to another provider but I have more than 100 apps on stores, cannot switch easily like that =/ I'm trying hard to recompile the module but I'm having some errors like ```Runtime disposed, cannot fire event 'disposehandle'``` – Carlos Zinato Mar 29 '16 at 14:53
  • Have you contacted UA and asked for their assistance or reached out to Appcelerator? – Brandon McGhee Mar 31 '16 at 12:28
1

Update: Urban Airship now provides a titanium module

ralepinski
  • 1,756
  • 8
  • 15
  • Thank you so much @ralepinski...I was starting something with autopilot but as far as I saw the module is already calling the takeOff on app creation. I've found this http://docs.appcelerator.com/platform/latest/#!/guide/Android_Module_Architecture-section-43289000_AndroidModuleArchitecture-ModuleLifecycleEvents that's seems to be exactly the same, right? Another thing, I'm receiving notifications with the app closed but the notification is not been displayed on device's status bar (notification center) =/ I'm able to start the app, but not display a simple message – Carlos Zinato Apr 01 '16 at 08:30
  • Thanks for your fork, I've tried but it isn't working as well =/ I mean, I get notified (I can force open the app from the module code) but don't see any message on phones status bar - tried on 3 devices. I'm getting this message with your forked version: "UALib: Unable to start location service. Check that the location service is added to the manifest." Do you think could be something? Really appreciate your efforts on it =) – Carlos Zinato Apr 01 '16 at 09:45
  • I guess I have to get more familiar with TI than I would of liked. The location service log is from https://github.com/rlepinski/ti.urbanairship/blob/master/android/timodule.xml#L86, Should not change how notificaiton are received. Lets move this to a github issue on the fork. When you do, post your verbose logs of a push being received in the background. You can enable verbose logging by setting `developmentLogLevel = VERBOSE` and `productionLogLevel = VERBOSE` in the airship config properties. Make sure you do not post any app keys/secrets while doing so. – ralepinski Apr 01 '16 at 17:16
  • hi ralepinski, really appreciate your help on it! Yesterday we managed to make the module works perfectly on Android but using UA SDK 6.0.2. If we update it to 6.4 or 7.0 it crashes the app. Here's the log: http://s28.postimg.org/7ochitfxp/Screen_Shot_2016_04_14_at_12_57_43.png It says that ```NotificationActionButtonGroupFactory``` could not be found inside com.urbanairship.push. Indeed, in docs it doesn't show this class, so seems to be something inside the UA .jar file not in the module itself =/ – Carlos Zinato Apr 14 '16 at 10:59
  • and here's another thing we're trying to solve. Is it possible to change the notification app icon and bg color on runtime? Or it is only possible while taking of? I saw your answer on this thread http://stackoverflow.com/questions/10666022/urban-airship-custom-icon-for-default-status-bar-notification and it just works on our module. But would be nice to change it on the fly. Thanks! – Carlos Zinato Apr 14 '16 at 11:02
  • @CarlosHenriqueLustosa Glad you got it working. For the notification icon and color, we are making it configurable through the airship config in the next SDK release. The NotificationActionButtonGroupFactory issue is actually missing resources, not a missing class. I think the jar needs to move its resources out of the jar file and into android/platform/android/res and then add `respackage: com.urbanairship` to manifest file. Facebook module has an example of this - https://github.com/mokesmokes/titanium-android-facebook/blob/master/manifest#L11. – ralepinski Apr 14 '16 at 16:16
  • @CarlosHenriqueLustosa We are now working on a plugin - https://github.com/urbanairship/titanium-module. It would be awesome if you could verify it works. – ralepinski Apr 15 '16 at 00:58
  • Hi @ralepinski, it doesn't work =/ I've built the module using ant and when I require it on tiapp.xml and try to build the app it says ```Could not find all required Titanium Modules: [ERROR] id: com.urbanairship version: 1.0.0 platform: android deploy-type: development``` Have no idea why. Do you have a distribution version of it? Also tried to put the 7.0.4 + res and ```respackage: com.urbanairship``` in my project. It runs fine and register successfully but did not display the notification =/ I'm really happy with you interest on it! Hope we manage to make it work =] – Carlos Zinato Apr 15 '16 at 13:11
  • @CarlosHenriqueLustosa I created an issue for you https://github.com/urbanairship/titanium-module/issues/1. Lets move the conversation there. – ralepinski Apr 15 '16 at 15:58
  • Ok now I've tested it with the latest Titanium SDK (5.2.2.GA) and it just works perfectly on iOS and Android \o/ Thank you so much for your support @ralepinski – Carlos Zinato Apr 26 '16 at 09:32
-1

Urban Airship module has issues with Android Lollipop and higher. The module is not updated and there is no assurance when it will be so. Switching for Appcelerator's Arrow system for notifications and using Ti.CloudPush module is the best idea at this moment.

Saeed Sharman
  • 765
  • 5
  • 24