Skip to content

Commit 15d09a6

Browse files
authored
Merge pull request #516 from x13945/bugfix_custom_message_in_android_not_meet_api_doc
bugfix: 保持iOS和Android平台下收到同样的自定义消息
2 parents c81c883 + cd5c444 commit 15d09a6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

android/src/main/java/cn/jpush/reactnativejpush/JPushModule.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ private static void sendEvent() {
163163
WritableMap map = Arguments.createMap();
164164
map.putInt("id", mCachedBundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID));
165165
map.putString("message", mCachedBundle.getString(JPushInterface.EXTRA_MESSAGE));
166+
map.putString("content", mCachedBundle.getString(JPushInterface.EXTRA_MESSAGE));
167+
map.putString("content_type", mCachedBundle.getString(JPushInterface.EXTRA_CONTENT_TYPE));
168+
map.putString("title", mCachedBundle.getString(JPushInterface.EXTRA_TITLE));
166169
map.putString("extras", mCachedBundle.getString(JPushInterface.EXTRA_EXTRA));
167170
mRAC.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
168171
.emit(mEvent, map);
@@ -177,7 +180,7 @@ private static void sendEvent() {
177180
.emit(mEvent, map);
178181
break;
179182
}
180-
183+
181184
mEvent = null;
182185
mCachedBundle = null;
183186
}

example/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export default class App extends Component {
228228

229229
JPushModule.addReceiveCustomMsgListener(map => {
230230
this.setState({
231-
pushMsg: map.message
231+
pushMsg: map.content
232232
})
233233
console.log('extras: ' + map.extras)
234234
})

0 commit comments

Comments
 (0)