question

LeonTx avatar image
LeonTx asked

Does NotificationCompat Builder work differently on Kindle Android devices?

I'm using the same code I use on all other android devices, but setSound, setTicker, and setNumber don't work as expected in my Kindle testing. Do I need to do something different? Or are they not supported? Or am I doing something wrong? Here's my code, thanks. Uri sound = Uri.parse("android.resource://com.myco.myapp/raw/push"); NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx) .setSmallIcon(R.drawable.ic_stat_gcm) .setContentTitle("My App") .setContentText(msg) .setTicker(msg) .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)) .setAutoCancel(true) .setOnlyAlertOnce(true); //if (pushSetting >= 2) builder.setDefaults(Notification.DEFAULT_VIBRATE); //if (badge > 0) builder.setNumber(11); //badge); //if (pushSetting >= 3) builder.setSound(sound); builder.setContentIntent(contentIntent); NotificationManager notificationManager = (NotificationManager)ctx.getSystemService(Context.NOTIFICATION_SERVICE); //notificationManager.notify((int)System.currentTimeMillis(), builder.build()); notificationManager.notify((int)1, builder.build());
amazon device messaging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
You can follow the guidance below when constructing notifications using the NotificationCompat.Builder class: 1. Vibration is not supported on any of the Kindle Fire devices 2. setSound works on every Kindle Fire device (from the First generation to the current HDX models inclusive) 3. setNumber works only on the Kindle Fire HDX devices and the 2nd Generation HD device (recently released) 4. setTicker currently only works on the Kindle Fire 1st Generation (running Android API 10)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jenleigh90 avatar image
jenleigh90 answered
I am using NotificationCompat.Builder with the setNumber method in a Fragment. The number shows up on 2nd gen HD devices, but not the 7" HDX and 8.9" HDX. Am I missing something? int number = 5; NotificationManager notificationManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder builder = new NotificationCompat.Builder(getActivity()); builder.setSmallIcon(R.drawable.small_icon); builder.setLargeIcon(R.drawable.large_icon); builder.setContentTitle(getResources().getString(R.string.content_title)); builder.setContentText(getResources().getString(R.string.content_text)); builder.setProgress(0, 0, false); builder.setNumber(number); Notification notification = builder.build(); notificationManager.notify(1, notification);
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.