2016-09-01 7 views
4

GCMプッシュ通知アイコン

{ 
    "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...", 
    "notification" : { 
     "body" : "great match!", 
     "title" : "Portugal vs. Denmark", 
     "icon" : "myicon" 
    } 
    } 

私の質問は、「myicon」は、アイコンの名前ですそれは存在するのだろうか? 例:私はドロイド「myicon.png」のアンドロイドスタジオの私のプロジェクトにいますか? またはそれはどこですか? drawableからAPPICONがあなたのdrawableフォルダ

またはこのコードを使用するから.pngファイルをある.setSmallIcon(R.drawable.appicon)ようなあなたのアプリのアイコンを使用して、誰かが教えてくださいと感謝事前

+0

うん、あなたはそれを持っていますあなたのドロウアブルでだから、その名前に応じてあなたの論理を作るか、名前でアイコンを取得するために使用します。 –

+0

@ArjunGurung私はあなたがAndroid側にもいくつかのコードを書く必要があるということを理解していませんでしたか? –

+0

あなたは@Haidarを持っています –

答えて

0

中:

NotificationCompat.Builder notificationBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this) 
     .setSmallIcon(R.drawable.icond) 
     .setContentTitle("Start Launcher") 
     .setContentText(message) 
     .setAutoCancel(true) 
     .setOngoing(true) 
     .setWhen(System.currentTimeMillis()) 
     .setContentIntent(pendingIntent); 

    NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); 

    notificationManager.notify(ID_NOTIFICATION , notificationBuilder.build()); 
関連する問題