New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setRegistrationTokenUpdateListener does not return the deviceToken #109
Comments
I found a solution by removing the ReactNativeHost in MainApplication. I don't know why but it works anyway. Then, the second question is when the device receive A and B notices (A first, then B), tapping or opening B notice will return A. The result is difficult to control using this library. I suggest you guest can take the reference of react-native-push-notification. It makes things simpler, more directly and result oriented. |
did you find a solution when tappening on B notification case? |
The token did exist and the event emitter did got called the method below, but it could likely be due to context issue that the event was not received by the JS listener.
|
I solved this issue by calling |
Does anybody can share an example please ?
but I didn`t see the token in console. |
+1 |
Has anyone been able to find a fix for this? Without being able to grab the device token on Android this renders the library almost useless. Below is my code. Javascript:
Main Application.java (ExpoKit)
|
dont use RNN as if it was a Component thing |
@arcollector even so. Wouldn't calling |
it doesnt matter, token will always be the same, token only changes when app is unistalled and isntalled again |
I understand. The issue is that the following code is never being hit no matter where in the app it is placed. I am only able to receive the token by looking through the Android Studio Logs
|
Same here, that code is never hit. |
Looks like it’s an issue for sure. I’ll see if we can pinpoint the problem and open a PR. We are experiencing this issue on a detached ExpoKit app. Are people experiencing the same issue on regular react-native? |
@lucadegasperi @thadeu I solved it! By writing native code.... despite I have never written Java in my life lol. In the GcmToken.js file located in the com.wix.reactnativenotifications directory do the following steps. import the following
and the following line below "final protected Context mAppContext;"
it should look like this
Then overwrite the sendTokenToJs() method as follows:
Enjoy your push notification token sent to the Javascript! Please let me know if this works for you guys as I am willing to open a PR to ensure no one has to go through this again. @lidanh: Is Wix actively supporting this package? Would you like me to open a PR with the code above to get this bug closed? |
@Daadler6 I'll test, I'll give you a feedback as soon as possible. Thanks. |
One thing to note as well. I refresh the token... this might not be necessary depending on where you have the listener in your application.
|
Is anyone looking at this issue? |
according to the recommendations in wix#109
@Daadler6 Thanks! it works for me. |
After setting up the Google Play store in my emulator and adding |
@Daadler6 Unfortunately this does not work for me, any other suggestions? |
@ronilitman - ended up using https://github.com/zo0r/react-native-push-notification. Much much easier to work with on IOS and Android (especially if you are using Expo) |
@ronilitman Could you check in your android/gradles.properties if android.enableAapt2=false |
@youssefatti Looks like this is working. thank you! |
@youssefatti As I see Aapt1 is going to be deprecated until the end of 2018, so is it ok to use it still? what are the alternatives? |
@ronilitman yes you can use it for now. i will looking for remove it later. Alternatives !! no clue for now |
For me it was android.enableAapt2=false in android/gradles.properties |
@youssefatti Have you figured this out? :) This will become a serious issue with some of the following Gradle upgrades! I don't know who maintain the package to make a mention in the comment. |
@dbelchev not yet, and im afraid to going througth this issue. and i will need to update my app very soon. i will keep you in touch if any changes |
In case this helps others, I was experiencing a very similar issue recently where The installation docs recommend that the GCM Sender ID be defined similar to this <manifest>
...
<application>
...
// Replace '1234567890' with your sender ID.
// IMPORTANT: Leave the trailing \0 intact!!!
<meta-data android:name="com.wix.reactnativenotifications.gcmSenderId" android:value="1234567890\0"/>
</application>
</manifest>
As I understand it the This was resulting in a The fix for us was to define a variable in a
My guess is that Sorry for the length of this, but hoping this saves some other folks some pain. If I'm not the only one experiencing this, we should also get the install docs updated for the library. |
Awesome @MattHaugen that solved it! |
@MattHaugen thanks it works |
@MattHaugen excellent debugging and information! Many thanks! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The issue has been closed for inactivity. |
I am moving from react-native-push-notification to this one because of the conflict of the RNN-RNPN. However, it does not work in my case. PendingNotifications.getInitialNotification returns undefined and NotificationsAndroid.setRegistrationTokenUpdateListener does not returns deviceToken.
I can see the result and correct response in Android monitor Logging (App initialized => publishing existing token (dc5oJgMT-qw:APA ...). But, I cannot get any response from JS. What can I do with that?
I also try the example of this one.
https://github.com/chrise86/rn-notification-navigation
It gives me the same result.
The text was updated successfully, but these errors were encountered: