arleyandrada / PushClient

FREE and Open Source - Titanium PushClient Module
Other
44 stars 17 forks source link

Android 5.0 icon is missing #52

Closed somefakeuser closed 9 years ago

somefakeuser commented 9 years ago

Hello Arley,

I believe you were talking with my colleague xxxx regarding the missing icon on Android 5.0. We are moving to production on 2/2 with this app and really need to get this matter resolved. Do you have an example of this module working with a parse payload on Android 5.0 that we could use for reference? Barring that, I’m wondering if we could check out the Android source so that we could get some idea of what is going on and make sure all our naming aligns with the module.

Thanks,

arleyandrada commented 9 years ago

Yes, I've been in contact with xxxx.

In my last contact, I sent to him what is required to set icons on Android and I had understood that everything was working (I had no feedback from him).

After some new tests I have identified some bad code, for specific scenarios, and fixed it now.

Attached is a fixed PushClient module version.

Try to send the following JSON payload data from Parse.com:

Large icon from URL and small icon with default app icon:

{
"alert" : "Hello world!",
"largeIcon" : "http://rocketdock.com/images/screenshots/supermario.png"
}

Large icon from assets folder ("/app/assets/android" for alloy or "/Resources/android" for classic):

{
"alert" : "Hello world!",
"largeIcon" : "mario.png"
}

Custom small icon from resources (required do put png image in "/platform/android/res/drawable"):

{
"alert" : "Hello world!",
"smallIcon" : "mario"
}

Combined small icon and large icon:

{
"alert" : "Hello world!",
"smallIcon" : "mario",
"largeIcon" : "http://rocketdock.com/images/screenshots/supermario.png"
}

Sorry about any inconvenience.

Regards,

P.S.: Unfortunately my module is not open-source.

Arley

[ attachment removed ]

somefakeuser commented 9 years ago

Hi Arley,

Thanks for getting back to me. We'll drop this in and give it a go tomorrow.

Thanks,

somefakeuser commented 9 years ago

Hey Arley,

I was able to get the icon to work with the updated version of the module. I sent this payload via Parse:

{
    "alert": "Test message for Android notification icon changes, please ignore",
    "smallIcon": "notification"
}

And having a notification.png in the correct drawable folders in platform/res/drawable, the icon showed up correctly. However, I did try this payload:

{
    "alert": "Test message for Android notification icon changes, please ignore",
    "smallIcon": "notification",
    "largeIcon": "appicon"
}

Where appicon is the application launcher icon drawable for the app, and it did not show up as expected. What I was expecting is for the app icon to show up on the lockscreen and in the notification shade, but have the smaller icon show up in the status bar and under the large icon in the notification shade and the lockscreen (Android 5.0), however, the smallIcon only showed up, with no largeIcon. If I sent the following data:

{
    "alert": "Test message for Android icon changes",
    "largeIcon": "http://rocketdock.com/images/screenshots/supermario.png"
}

The largeIcon showed up fine, as expected. And when combining the two as such:

{
    "alert": "Test message for Android notification icon changes, please ignore",
    "smallIcon": "notification",
    "largeIcon": "http://rocketdock.com/images/screenshots/supermario.png"
}

I was able to get the largeIcon to show up just fine. Also, specifying a png in the assets folder as such:

{
    "alert": "Test message for Android notification icon changes, please ignore",
    "smallIcon": "notification",
    "largeIcon": "appicon.png"
}

Worked as well.

This works fine for our application, but I want to make sure the module is working as intended, since currently you cannot specify pngs from the platform/res/drawable folder for the largeIcon.

Thanks again for your help,

arleyandrada commented 9 years ago

To set the "smallIcon" you need to put your images in the "drawable" folder (required) and provide the PNG image file name always without extension.

To set the "largeIcon" you can use an external url to a PNG image... or need to put your PNG image in assets folder (not at drawable folder) and you need to provide the image file name always with extension.

That's all.

Success to your project!

Regards,

Arley