[問題] startForeground不顯示Notification

看板AndroidDev作者 (652公車)時間12年前 (2013/04/30 20:12), 編輯推噓3(3013)
留言16則, 5人參與, 最新討論串1/2 (看更多)
※ 引述《gpc (gpc)》之銘言: : ※ 發信站: 批踢踢實業坊(ptt.cc) : ◆ From: 114.37.230.54 : 推 qweqweqweqwe:4.x之後可以把提醒關掉是指foreground service 可以 04/29 23:50 : → qweqweqweqwe:隱藏 notification 嗎? 04/29 23:50 : 推 tga123:真的!大多使用者都不會看~當初想裝仙劍看到莫名其妙的權限 04/30 09:46 : → tga123:就不想裝了..Service很好玩可以做一堆有趣的程式 04/30 09:47 : → gpc:回一樓 yes API有! 04/30 09:57 http://bit.ly/14zIg2y 我找不到startForeground要如何不顯示Notification耶, 請問是哪個API可以這樣子用呢? 因為有使用者不想要status bar多了一個icon,覺得這樣子空間被浪費掉了 XD -- 雜七雜八的kewang部落格 http://kewang.tw -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.70.102.236

05/01 10:07, , 1F
如果不要顯示的話 那跟service就沒有差別了吧
05/01 10:07, 1F

05/01 10:43, , 2F
嗯? 但是設成foreground不是要放一個notification嗎
05/01 10:43, 2F

05/01 10:48, , 3F
嗯? 但是設成foreground不是要放一個notification嗎
05/01 10:48, 3F

05/01 10:49, , 4F
不小心多送了一次 XD
05/01 10:49, 4F

05/01 14:05, , 5F
可是gpc說可以在foreground的時候不顯示notification,我比
05/01 14:05, 5F

05/01 14:06, , 6F
較想知道是怎麼做的
05/01 14:06, 6F

05/01 16:00, , 7F
我印象中 直接帶null 或是產生notification時候 不要設
05/01 16:00, 7F

05/01 16:00, , 8F
任何參數
05/01 16:00, 8F

05/01 18:20, , 9F
樓上說的方法應該行不通,以前有看過這段code
05/01 18:20, 9F

05/01 18:21, , 10F
notification 是 null 在setServiceForeground 會
05/01 18:21, 10F

05/01 18:21, , 11F
直接被拋出例外 有興趣可以看ActiveServices
05/01 18:21, 11F

05/01 18:21, , 12F
或者 ActivityManagerService
05/01 18:21, 12F

05/01 18:22, , 13F
另外當 notification.icon == 0 也會被遺棄
05/01 18:22, 13F

05/01 18:22, , 14F
記得看NotificationManagerService 可以略知一二!
05/01 18:22, 14F

05/01 18:22, , 15F
有錯請指正
05/01 18:22, 15F

05/01 19:45, , 16F
樓上正確XD
05/01 19:45, 16F
文章代碼(AID): #1HVxL36l (AndroidDev)
文章代碼(AID): #1HVxL36l (AndroidDev)