Опитвам се да покажа хедс-ъп тип известие, но не можах. Това, което опитах
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)
това ли е най-добрият начин?