Я пытаюсь показать хедз-ап типа уведомления, но не смог. Что я пробовал
final Notification.Builder notif = new Builder(getApplicationContext())
.setContentTitle(getString(R.string.title))
.setContentText(getString(R.string.text))
// .setTicker(getString(R.string.tick)) removed, seems to not show at all
// .setWhen(System.currentTimeMillis()) removed, match default
// .setContentIntent(contentIntent) removed, I don't neet it
.setColor(Color.parseColor(getString(R.color.yellow))) //ok
.setSmallIcon(R.drawable.ic_small) //ok
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher))
// .setCategory(Notification.CATEGORY_CALL) does not seem to make a difference
.setPriority(Notification.PRIORITY_MAX); //does not seem to make a difference
// .setVisibility(Notification.VISIBILITY_PRIVATE); //does not seem to make a difference
mNotificationManager.notify(Constants.NOTIFICATION_ID, notif.build());
Уведомление отображается только в виде значка на панели. Я использую API 21 на эмуляторе API 21 (не предварительная версия L). Я пробовал:android:Theme.Holo.NoActionBar
,android:Theme.Holo.NoActionBar.Fullscreen
и NotificationCompat.Builder
Примеры SDK недоступны. кто нибудь знает как это сделать?
Я заставил его работать, добавив:
.setDefaults(Notification.DEFAULT_VIBRATE)
это лучший способ?