Skip to content

Commit

Permalink
Fix notifications not working in Android emulator
Browse files Browse the repository at this point in the history
Fixes #3113

The native code inside `react-native-notifications` varied its
behavior when reading the `gcm_id` value from the metadata. Because
of this it was throwing a `MismatchSenderId` error.

One solution that was suggested in the GitHub's Issues was renaming
`android:value="your_sender_id\0"` to `android:value="your_sender_id\"`
This worked but I was a bit unconmfortable with the contrary suggestion
in the official documentation `// IMPORTANT: Leave the trailing \0 intact!!!`

Instead, extract this value to a string resource and refer it by name.
  • Loading branch information
borisyankov committed Nov 6, 2018
1 parent be20743 commit 554d576
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions android/app/src/main/AndroidManifest.xml
Expand Up @@ -67,7 +67,6 @@
<category android:name="com.zulipmobile" />
</intent-filter>
</receiver>
<meta-data android:name="com.wix.reactnativenotifications.gcmSenderId" android:value="835904834568\0"/>
<meta-data android:name="com.wix.reactnativenotifications.gcmSenderId" android:value="@string/gcm_id"/>
</application>

</manifest>
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
@@ -1,6 +1,7 @@
<resources>
<string name="app_name">Zulip</string>
<string name="notification_channel_name">Notifications</string>
<string name="gcm_id">835904834568</string>
<string name="no_browser_found">No Browser Found</string>
<plurals name="messages">
<item quantity="one"></item>
Expand Down

0 comments on commit 554d576

Please sign in to comment.