Push api - why is 'payload' parameter duplicated and what happens when you set both?

Looking at the Push API docs, for the Request, you have a ‘payload’ object near the top level, outside the ‘ios’ and ‘android’ configs. And then each of IOS and Android configs have their own ‘payload’ object. From what I read, the ios.payload and android.payload configs ‘override’ the outer config.

The behavior I see (100% reproducible) is that IFF I send a notification request that ONLY has the outer ‘payload’ set, I get a failure from IONIC service saying 'null pointer exception.

If I put my ‘payload’ config/object in both places (i.e. top level, inside ‘ios’ and inside ‘android’) I don’t get that exception, but what I see for android is this:

06-15 23:44:09.169 30171 30288 V PushPlugin: extrasToJSON: {"event":"message","from":"89940107206","message":"sdfsdf","coldstart":true,"foreground":false,"payload":{"payload":{"type":"GENERAL"},"sound":"sound.wav","title":"ste","google.message_id":"0:1497588233390156%e0f6b3faf9fd7ecd","message":"sdfsdf"}}

Why does it have 2 ‘payload’ attributes nested? Strange … {payload: {payload: …}}

What’s going on? Anyone?

I would guess the outer payload is vocabulary from Ionic Push for “that’s the stuff we send to Android servers”. The inner “payload” then is “random data part next to the structured part Android servers expect”. Same name, different recipient and meaning.

But that’s just a guess, would have to look into the GCM/FCM docs to find out what their payload looks like.