2016-04-01 21 views
0

私のプロジェクトでは、pushbotを使用して通知をデバイスに送ります。今はアプリのロゴを表示していますが、アプリのロゴの代わりに「R.drawable.alert」と表示されることをお勧めします。だからそれについてどうやって行くのか。私はカスタムハンドラクラスのコードを投稿しています。私はプッシュボットと一緒に働いています。Android:設定通知画像

カスタムハンドラクラス

public class customHandler extends BroadcastReceiver 
{ 
    private static final String TAG = "customHandler"; 
    @Override 
    public void onReceive(Context context, Intent intent) 
    { 
     String action = intent.getAction(); 
     android.util.Log.d(TAG, "action=" + action); 
     // Handle Push Message when opened 
     if (action.equals(PBConstants.EVENT_MSG_OPEN)) { 
      //Check for Pushbots Instance 
      Pushbots pushInstance = Pushbots.sharedInstance(); 
      if(!pushInstance.isInitialized()){ 
       com.pushbots.push.utils.Log.d("Initializing Pushbots."); 
       Pushbots.sharedInstance().init(context.getApplicationContext()); 
      } 

      //Clear Notification array 
      if(PBNotificationIntent.notificationsArray != null){ 
       PBNotificationIntent.notificationsArray = null; 
      } 

      HashMap<?, ?> PushdataOpen = (HashMap<?, ?>) intent.getExtras().get(PBConstants.EVENT_MSG_OPEN); 
      android.util.Log.w(TAG, "User clicked notification with Message: " + PushdataOpen.get("message")); 

      //Report Opened Push Notification to Pushbots 
      if(Pushbots.sharedInstance().isAnalyticsEnabled()){ 
       Pushbots.sharedInstance().reportPushOpened((String) PushdataOpen.get("PUSHANALYTICS")); 
      } 

      //Start lanuch Activity 
      String packageName = context.getPackageName(); 
      Intent resultIntent = new Intent(context.getPackageManager().getLaunchIntentForPackage(packageName)); 
      resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_CLEAR_TASK); 

      resultIntent.putExtras(intent.getBundleExtra("pushData")); 
      Pushbots.sharedInstance().startActivity(resultIntent); 

      // Handle Push Message when received 
     }else if(action.equals(PBConstants.EVENT_MSG_RECEIVE)){ 
      HashMap<?, ?> PushdataOpen = (HashMap<?, ?>) intent.getExtras().get(PBConstants.EVENT_MSG_RECEIVE); 
      android.util.Log.w(TAG, "User Received notification with Message: " + PushdataOpen.get("message")); 
     } 
    } 


} 

答えて

0

あなたがそれをしなければならないすべては、サーバーへ、およびサーバpushbotsのアイコンをアップロード>「カスタムペイロード」、Key=largeIcon、およびアイコンのValue=URLで書きます。ここで

画像例
enter image description here

詳細情報:PushBots tutorial

関連する問題