Skip to content

Commit

Permalink
fix(android): receive notification when app is killed
Browse files Browse the repository at this point in the history
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
  • Loading branch information
90dy committed Feb 1, 2019
1 parent fe1dc64 commit c9aa409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Expand Up @@ -14,6 +14,7 @@

import java.util.Map;

import chat.berty.core.Level;
import chat.berty.core.Logger;
import core.Core;
import core.MobileNotification;
Expand All @@ -34,7 +35,12 @@ public class NotificationHandler extends FirebaseMessagingService implements Act
public void onMessageReceived(RemoteMessage remoteMessage) {
Map<String, String> map = remoteMessage.getData();
String data = new Gson().toJson(map);
this.notificationDriver.receive(data);
try {
Core.getDeviceInfo().setStoragePath(getApplicationContext().getFilesDir().getAbsolutePath());
this.notificationDriver.receive(data);
} catch (Exception err) {
this.logger.format(Level.ERROR, TAG, "cannot get storage path: %s", err);
}
}

/**
Expand Down
3 changes: 1 addition & 2 deletions core/push/fcm.go
Expand Up @@ -64,12 +64,11 @@ func (d *FCMDispatcher) Dispatch(pushAttrs *PushData, pushDestination *PushDesti
payload := Payload{Chunk: base64.StdEncoding.EncodeToString(chunk)}

deviceToken := fcmIdentifier.DeviceToken

if _, err := d.client.NewFcmMsgTo(deviceToken, payload).Send(); err != nil {
return errorcodes.ErrPushProvider.Wrap(err)
}
}

logger().Info("push notifications with chunk send")
return nil
}

Expand Down

0 comments on commit c9aa409

Please sign in to comment.