2015-08-14 288 views
0

我從我的服務器上正確接收推送通知,但條形圖中的showen圖標與圖標的應用程序不同,我不知道這是哪裏來的。推送通知圖標GCM

這是我的代碼:

private void sendNotification(String msg, String page_id) { 
     mNotificationManager = (NotificationManager) 
       this.getSystemService(Context.NOTIFICATION_SERVICE); 


     Intent intent = new Intent(this, SplashActivity.class); 
     Bundle bundle = new Bundle(); 
     bundle.putString("page_id", page_id); 
     intent.putExtras(bundle); 
     intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); 
     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  PendingIntent contentIntent = PendingIntent.getActivity(this, 0, 
       intent , PendingIntent.FLAG_UPDATE_CURRENT); 
     NotificationCompat.Builder mBuilder = 
       new NotificationCompat.Builder(this).setAutoCancel(false) 
     .setSmallIcon(R.drawable.ic_launcher) 
     .setContentTitle(getResources().getString(R.string.app_name)) 
     .setStyle(new NotificationCompat.BigTextStyle() 
     .bigText(msg)) 
     .setContentText(msg); 
     mBuilder.setContentIntent(contentIntent); 
     mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); 
    } 

應用程序的圖標:

  • RES /提拉 - 華電國際大小:最高72x72
  • RES /繪製-LDPI尺寸:最高72x72
  • 資源/ drawable-mdpi size:48x48
  • res/drawable-xhdpi size:96x6
  • RES /繪製-xxhdpi尺寸144x144
+1

顯示的圖標是什麼?一個白色的廣場? –

+0

從另一個應用程序沒有圖標,即使我刪除它 – Euphor08

+0

'R.drawable.ic_launcher'這應該出現。如果你沒有改變你的應用程序圖標,它應該是Android的綠色頭。 –

回答

0

的問題是我的圖標在紋理貼圖文件夾,因爲,所以當我從mimap目錄更改爲繪製它的工作,感謝的。