2013-10-10 51 views

回答

0

我剛碰到同樣的問題。解決方案雖然很簡單。

使用NotificationCompat.Builder來創建通知,因爲只有Notification構造函數被棄用而不是整個類。

實施例:

NotificationCompat.Builder builder = new NotificationCompat 
     .Builder(getApplicationContext()); 
builder.setContentTitle("Updating..."); 
builder.setSmallIcon(R.drawable.ic_action_search); 

startForeground(NOTIFICATION_ID, builder.build()); 
相關問題