How to create notifications that don't go away when clicked in Android?

前端 未结 5 878
独厮守ぢ
独厮守ぢ 2021-02-05 21:18
int icon = R.drawable.icon4;        
CharSequence tickerText = \"Hello\"; // ticker-text
long when = System.currentTimeMillis();         
Context context = getApplicatio         


        
5条回答
  •  生来不讨喜
    2021-02-05 22:12

     if (android.os.Build.VERSION.SDK_INT>16)
        {
            notificationManager.notify(5, notification.build());
        }else
        {
            notificationManager.notify(5, notification.getNotification());
        }
    

    To work in android.os.Build.VERSION.SDK_INT<16 keep in mind to do some changes

提交回复
热议问题