Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android wear action item icon sizing vs phone notification action item sizing

I'm a little confused about what size an icon should be for my application's notification action items. I want to make the action items compatible for Android wear, but there is no documentation (that I can find) on what size to make the icons.

Looking at sample android wear projects, I see that the icon sizes for the android wear action items are 64dp x 64dp (for instance, reply). Looking from google source examples, I'm seeing that icon sizes for action items on phones match those of the action bar, with 32dp x 32dp size and a 24dp x 24dp optical square, also specified here.

When I keep the icons at 32x32, they look terrible on the android wear device, and when I keep them as 64x64, they are too large for the action item bar on the phone.

Is there a way (different res folder? using the WearableExtender?) to have the phone use a different icon for action items than the wearable?

like image 810
John Leehey Avatar asked Jul 29 '14 23:07

John Leehey


Video Answer


1 Answers

You need to specify the actions once again using the WearableExtender class. It will allow you to set a set of actions that will be visible only on Android Wear device (the original actions added to NotificationCompat.Builder will not be visible if you set at least one action via WearableExtender. So basically you just need to "repeat" all the actions in WearableExtender and specify different (bigger) icons there.

NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.addAction(new NotificationCompat.Action(R.drawable.reply_phone, "Reply", pendingIntent));
builder.extend(new NotificationCompat.WearableExtender()
            .addAction(new NotificationCompat.Action(R.drawable.reply_wear, "Reply", pendingIntent))
        );
like image 140
Maciej Ciemięga Avatar answered Oct 19 '22 22:10

Maciej Ciemięga