UrbanAirShip Support

Hi ,

I am trying to use push notification in my app , i did the add fuse code to handle registration and receiving the payload and i can receive notifications on both platforms ( iOS - android ) using firebase .

The problem is i would like to use “Urban Airship” in my app which require me to add Urban Airship SDK so UA(Urban Airship) could generate channel ID for android app users . unlike iOS if i send received deviceToken through http request to UA then i send/receive notifications on iOS.

My Questions is :
A - could you please point me on how to:

1- add the UA parameters in (UNO/uxl) which should reflect in Android files

2- how to add the UA SDK so it could compile with the both targets (iOS - Android)

3- how to expose the UA SDK to fuse ( at least the register functionality )

B- i am also working on integration with facebook account kit ( should i consider the same steps as “native facebook login example” )

really appreciate your help .

It looks like UA have both a Cocoapods and a Gradle library, so it should be possible to wrap them in Foreign code. You could refer to Fuse.Stripe implementation for details.


Thank you Uldis,

i have already started , and now i can register the app with UA , i have problem now with receiving notifications .

what i did is using UA Autopilot:

  • UNO class that have :
[Require("AndroidManifest.ApplicationElement", "<meta-data android:name=\"com.urbanairship.autopilot\" android:value=\"com.urbanairship.Autopilot\"/>")]
  • Creating a file at the root of my app

Create UXL file urban.uxl and reference it inside my app unoproj

<Extensions Backend="CPlusPlus" Condition="Android">
	<CopyFile Condition="Android" Name="airshipconfig.properties" TargetName="app/src/main/assets/airshipconfig.properties" />

i do confirm receiving notifications from UA while the app is in the foreground , however if it is closed or in the background nothing received !!

My question : Is it possible that fuse.pushNotification doing some config (restriction on payload format )?
you may ask why still using fuse.push is simply i did not finish Implementation of UA receivers as only using Autopilot for now.

To receive notifications while the app is in background will require you to do some additional coding. Perhaps you could take a look at how Fuse.PushNotifications are implemented and figure out what you’re missing with UA.

Thank you Uldis,

this exactly what i did ( was posting when you sent this :).

After a lot of issue , i could finally solve it by modifying Fuse.pushNotification Package .
unfortunately modifications on Package source was not reflected in my build ( Impl.uno ).

so i ended with modifying the generated AndroidImpl.Java and now even if push notification payload have title and body outside of aps or notification then it is going to show in notifications bar ( android )

  public static void OnNotificationRecieved(final Object listener,final String from,final Object _bundle)
        final Bundle bundle = (Bundle)_bundle;
        if (!PushNotificationReceiver.InForeground) {
        	String notification = bundle.getString("notification");
        	String aps          = bundle.getString("aps");
            String UA           = bundle.getString("com.urbanairship.push.ALERT");
            String _title       = bundle.getString("title");
            String _body        = bundle.getString("body");
        	if (notification != null) {
        		// using the google style 'notification' subtree
        		com.foreign.Fuse.PushNotifications.AndroidImpl.NotificationFromJson434(listener, notification, bundle);
        	} else if (aps != null) {
        		// using the apple style 'aps' subtree
        		com.foreign.Fuse.PushNotifications.AndroidImpl.NotificationFromJson434(listener, aps, bundle);
        	} else if (UA!=null){
                 // using the apple style UA 
                    com.foreign.Fuse.PushNotifications.AndroidImpl.SpitOutNotification435(listener,UA, _body, "", "", "", "", "", bundle);   
                    com.foreign.Fuse.PushNotifications.AndroidImpl.SpitOutNotification435(listener,UA, "", "", "", "", "", "", bundle);   
            }else if(_title!=null){
            // Add General Support to Title and body
                    com.foreign.Fuse.PushNotifications.AndroidImpl.SpitOutNotification435(listener,_title, _body, "", "", "", "", "", bundle);   
                    com.foreign.Fuse.PushNotifications.AndroidImpl.SpitOutNotification435(listener,_title, "", "", "", "", "", "", bundle);   

            }else {
        } else {

and having simple script to copy my modified version and rebuild mybuild.sh

uno clean
uno build --target=Android -DGRADLE --configuration=Release
cp android_build/AndroidImpl.txt "${PWD}"/build/Android/Release/app/src/main/java/com/foreign/Fuse/PushNotifications/AndroidImpl.Java
sh "${PWD}"/build/Android/Release/build.sh

i know it is going to break in way or another as it seems the generated Java file has functions name with generated numbers .
FuseTeam could you confirm if we as users can modify the code of source package ? (Impl.uno) inside pushNotification for example