2014-03-03 74 views
1

好的,在我的Chrome擴展程序的清單中,我已經允許通知,現在我正在使用webkitNotifications,儘管我說豐富的通知並且更喜歡它們,所以我出去了並想通了如何寫他們需要哪些參數,所以我在控制檯中測試,但它沒有顯示出來?Chrome Rich Notifications not showing

chrome.notifications.create('report',{ 
    type:'basic', 
    title:'hello world', 
    message:'Dance with me please', 
    expandedMessage:'Hello thanks for using our app', 
    priority:1, 
    buttons:[{title:'Follow URL'},{title:'Remind me Later'}], 
    isClickable:true 
},function(){}); 

但我不知道這是否是我所需要的webkitNotifications需要一個show()功能實際上使其顯示。任何想法傢伙?

回答

1

iconUrlcreate方法所必需的。 http://developer.chrome.com/extensions/notifications#type-NotificationOptions

chrome.notifications.create('report',{ 
    type:'basic', 
    title:'hello world', 
    iconUrl: 'yourIconUrl', 
    message:'Dance with me please', 
    expandedMessage:'Hello thanks for using our app', 
    priority:1, 
    buttons:[{title:'Follow URL'},{title:'Remind me Later'}], 
    isClickable:true 
},function(){});