# UrbanAirShip Support 

**URL:** <https://forums.fusetools.com/t/urbanairship-support/3400>\
**Category:** How-to Discussions\
**Created:** [February 25, 2018, 8:57am UTC](https://forums.fusetools.com/t/urbanairship-support/3400 "2018-02-25T08:57:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GMB](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@GMB](https://forums.fusetools.com/u/GMB)\
**Post date:** [February 25, 2018, 8:57am UTC](https://forums.fusetools.com/t/urbanairship-support/3400/1 "2018-02-25T08:57:32Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [February 26, 2018, 7:38am UTC](https://forums.fusetools.com/t/urbanairship-support/3400/2 "2018-02-26T07:38:17Z")

</div>

It looks like UA have both a [Cocoapods](https://cocoapods.org/pods/UrbanAirship-iOS-SDK) and a [Gradle](https://github.com/urbanairship/android-library) library, so it should be possible to wrap them in [Foreign code](https://www.fusetools.com/docs/native-interop/foreign-code). You could refer to [Fuse.Stripe implementation](https://github.com/fuse-compound/Fuse.Stripe/blob/master/src/Core.uno) for details.

---

<div class="post-metadata">

**Author:** ![dkass](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/dkass/32/579_2.png) [@dkass](https://forums.fusetools.com/u/dkass)\
**Post date:** [February 27, 2018, 12:16am UTC](https://forums.fusetools.com/t/urbanairship-support/3400/3 "2018-02-27T00:16:00Z")

</div>

.

---

<div class="post-metadata">

**Author:** ![GMB](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@GMB](https://forums.fusetools.com/u/GMB)\
**Post date:** [February 27, 2018, 12:18am UTC](https://forums.fusetools.com/t/urbanairship-support/3400/4 "2018-02-27T00:18:36Z")

</div>

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 :

```auto
[Require("Gradle.Dependency.Compile","com.urbanairship.android:urbanairship-sdk:9.0.+")]
[Require("AndroidManifest.ApplicationElement", "<meta-data android:name=\"com.urbanairship.autopilot\" android:value=\"com.urbanairship.Autopilot\"/>")]

```

- Creating a file at the root of my app

```auto
airshipconfig.properties

```

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

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

```

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.

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [February 28, 2018, 7:10am UTC](https://forums.fusetools.com/t/urbanairship-support/3400/5 "2018-02-28T07:10:00Z")

</div>

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](https://github.com/fusetools/fuselibs-public/tree/master/Source/Fuse.PushNotifications) are implemented and figure out what you’re missing with UA.

---

<div class="post-metadata">

**Author:** ![GMB](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@GMB](https://forums.fusetools.com/u/GMB)\
**Post date:** [February 28, 2018, 7:12am UTC](https://forums.fusetools.com/t/urbanairship-support/3400/6 "2018-02-28T07:12:14Z")

</div>

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 )

```auto
  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 
                 if(_body!=null){
                    com.foreign.Fuse.PushNotifications.AndroidImpl.SpitOutNotification435(listener,UA, _body, "", "", "", "", "", bundle);   
                 }else{
                    com.foreign.Fuse.PushNotifications.AndroidImpl.SpitOutNotification435(listener,UA, "", "", "", "", "", "", bundle);   
                 }
            }else if(_title!=null){
            // Add General Support to Title and body
                if(_body!=null){
                    com.foreign.Fuse.PushNotifications.AndroidImpl.SpitOutNotification435(listener,_title, _body, "", "", "", "", "", bundle);   
                 }else{
                    com.foreign.Fuse.PushNotifications.AndroidImpl.SpitOutNotification435(listener,_title, "", "", "", "", "", "", bundle);   
                 }

            }else {
        		com.foreign.Fuse.PushNotifications.AndroidImpl.cacheBundle424(bundle);
        	}
        } else {
        	ExternedBlockHost.callUno_Fuse_PushNotifications_AndroidImpl_OnRecieve429((Object)bundle,(boolean)false,UnoHelper.GetUnoObjectRef((Object)bundle));
        }
    }

```

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

```auto
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
