chabokpush / chabok-demo-android

Android demo application using Chabok push service
5 stars 4 forks source link

مشکل در دریافت دیتا نوتیف هنگام بسته بودن اپ #3

Closed AliRHp closed 6 years ago

AliRHp commented 6 years ago

وقتی اپلیکیشن ران نیست دیتا نوتیفیکیشن رو از کجا بخونیم

Husseinhj commented 6 years ago

از کد زیر توی کلاس اپلکیشن استفاده کنین که توی داکیومنت توضیح داده شده

NotificationHandler myHandler = new NotificationHandler() {

    @Override
    public Class getActivityClass(ChabokNotification chabokNotification) {
    // return preferred activity class to be opened on this message's notification
    return YOUR_MAIN_ACTIVITY_CLASS.class;
    }

    @Override
    public boolean buildNotification(ChabokNotification chabokNotification, NotificationCompat.Builder builder) {
    // use builder to customize the notification object
    // return false to prevent this notification to be shown to the user, otherwise true
    return false;
    }
};

chabok.addNotificationHandler(myHandler);

این کد همیشه زمانی که پوش نویتیفکیشن بیاد تریگر خواهد شد