Note that there are some explanatory texts on larger screens.

plurals
  1. POapp notifications disrupt Pandora volume
    primarykey
    data
    text
    <p>Hoping someone can help with a weird bug: when our Android app posts a status bar notification and the user's listening to Pandora, the volume drops for the notification (as expected) but then doesn't come back up until the next song.</p> <p>This doesn't seem to happen with streaming apps other than Pandora, or with apps other than ours -- even though as far as I know our use of the notification APIs is standard. It's also restricted to certain devices: it doesn't happen on our Nexus 4 or Droid RAZR M, but we can reproduce it consistently on our Galaxy Nexus running 4.2.2.</p> <p>Any idea what's going on?</p> <p><strong>EDIT</strong> As requested, some info on our BroadcastReceiver code. Initially it does a bunch of stuff with our DB via a ContentProvider, to grab the info to display in the notification. Once that's done:</p> <pre><code>NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_notification_new_message) .setTicker(Html.fromHtml("&lt;strong&gt;" + senders[0] + "&lt;/strong&gt; " + summaries[0])) .setContentInfo((messageCount &gt; 1) ? Integer.toString(messageCount) : "").setAutoCancel(true); // Notification sound and vibration if (prefs.getBoolean(PREF_SOUND, true)) { setupSound(builder); } // Blinky light if (prefs.getBoolean(PREF_BLINK, true)) { setupLight(builder, LIGHT_COLOR); } Intent resultIntent; TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context); if (senders.length &gt; 1) { String contentTitle = messageCount + " new messages"; builder.setContentTitle(contentTitle); builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher)); NotificationCompat.InboxStyle bigStyle = new NotificationCompat.InboxStyle(); bigStyle.setBigContentTitle(contentTitle); HashSet&lt;String&gt; uniqueSenders = new HashSet&lt;String&gt;(senders.length); for (i = 0; i &lt; senders.length; i++) { bigStyle.addLine(Html.fromHtml("&lt;strong&gt;" + senders[i] + "&lt;/strong&gt; " + summaries[i])); uniqueSenders.add(senders[i]); } builder.setContentText(TextUtils.join(", ", uniqueSenders)); builder.setStyle(bigStyle); resultIntent = new Intent(App.getContext(), ChatListActivity.class); } else { builder.setContentTitle("Message from " + senders[0]); setLargeImage(context, lastCorrespondents, builder); builder.setContentText(summaries[0]); // Intent + back stack resultIntent = new Intent(context, ChatActivity.class); resultIntent.putExtra(MessageDbContract.KEY_CORRESPONDENTS, lastCorrespondents); taskStackBuilder.addParentStack(ChatActivity.class); } resultIntent.putExtra(Constants.INTENT_KEY_CALLER, getClass().getSimpleName()); // Finish configuring action invokeNotificationManager(context, builder, resultIntent, taskStackBuilder, NOTIFICATION_ID_NEW_MESSAGES); </code></pre> <p>And the helper functions referenced above:</p> <pre><code>private void setLargeImage(Context context, String lastCorrespondents, NotificationCompat.Builder builder) { // Set large image try { Uri imageUri = Util.getThumbnailUriForCorrespondents(context, lastCorrespondents); Bitmap largeImage = MediaStore.Images.Media.getBitmap(context.getContentResolver(), imageUri); builder.setLargeIcon(largeImage); } catch (IOException e) { Util.log(this, "Encountered IOException when setting large icon for new message notification."); } } private void setupLight(NotificationCompat.Builder builder, int lightColor) { builder.setLights(lightColor, LIGHT_ON_DURATION, LIGHT_OFF_DURATION); } private void setupSound(NotificationCompat.Builder builder) { Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); builder.setSound(uri); builder.setVibrate(VIBRATION_PATTERN); } private void invokeNotificationManager(Context context, NotificationCompat.Builder builder, Intent resultIntent, TaskStackBuilder taskStackBuilder, int notificationId) { taskStackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = taskStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(resultPendingIntent); // Get notification manager, create notification, and notify. NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(App.NOTIFICATION_NEW_MESSAGE, notificationId, builder.build()); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload