Skip to content

Commit a9e0632

Browse files
authored
Merge pull request #29 from zoyi-jin/fix/fixNotificationContext
Fix notification context
2 parents 54c6f58 + 32efdf5 commit a9e0632

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

android/src/main/java/com/zoyi/channel/rn/RNChannelIO.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ public void initPushToken(String tokenData) {
128128

129129
@ReactMethod
130130
public void handlePushNotification(ReadableMap userInfo, Promise promise) {
131-
Context context = getCurrentActivity();
131+
if (reactContext != null) {
132+
Context context = reactContext.getApplicationContext();
132133

133-
if (context != null){
134-
ChannelIO.showPushNotification(context, ParseUtils.toPushNotification(userInfo));
134+
if (context != null) {
135+
ChannelIO.showPushNotification(context, ParseUtils.toPushNotification(userInfo));
136+
}
135137
}
136138

137139
promise.resolve(true);

0 commit comments

Comments
 (0)