官方文檔里的代碼有點點問題 , 可以按照下面這樣延時去調用plus的代碼 , 等待plus加載完畢
另外增加上條件編譯 , 只有在app下面這段代碼才會編譯
//#ifdef APP-PLUS // 頁面加載時觸發 setTimeout(function(){ if(plus){ var pinf = plus.push.getClientInfo(); var cid = pinf.clientid;//客戶端標識 console.log(cid); //監聽系統通知欄消息點擊事件 plus.push.addEventListener('click', function(msg){ //處理點擊消息的業務邏輯代碼 }, false); //監聽接收透傳消息事件 plus.push.addEventListener('receive', function(msg){ //處理透傳消息的業務邏輯代碼 var options = {cover:false}; plus.push.createMessage(msg,"RemoteMSG",options); }, false); } },4000); //#endif
client_id能獲取到

