按我已經在應用中使用的變化和context.startForegroundService(Intent)
然後像以前一樣調用服務startForeground
開始在後臺服務的文檔。的Android O不可顯示前景化的服務通知
NotificationCompat.Builder notification = new
NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(R.mipmap.icon)
.setContentText("Content")
.setOngoing(true)
.setContentInfo("Info")
.setContentTitle("Title");
startForeground(1, notification.build());
這正確地顯示在Android N器件上,但是在Android O設備不顯示通知它只顯示新「是在後臺運行...點擊有關電池更多的細節和所述通知數據使用」
有缺什麼去在AndroidØ正確顯示的通知?
你能對你所說的這是什麼展開notfication? – Ryan
哦,你的意思是在beta支持庫的新構造?不幸的是,由於外部限制,我無法使用beta庫。我只是做一個庫面向未來的用戶,我會更新庫,當他們移動到V26 – Ryan
是,使用v26.0.0-β2 – greywolf82