Standalone Android sdk 19.0.0 getDevicePushTokenAsync exception

#1

const deviceToken = await Expo.Notifications.getDevicePushTokenAsync();

{ [Error: Cannot convert argument of type class com.facebook.react.bridge.WritableNativeMap] framesToPop: 1, code: 'EUNSPECIFIED' }

Does anyone have standalone getDevicePushTokenAsync working on android?

If this is a bug, it would be great to figure out if it also continued in sdk 20, and hopefully prevent it from making sdk 21.

Can anyone think of workarounds? @expo - I’m going to start storing ExpoTokens for now. Would you be able to export the corresponding native tokens to me at a later date once this is resolved, so I can get back on track?

For ExpoTokens to be created, Expo must be getting the native token successfully somehow. So hopefully there is another workaround I can use?

0 Likes

#2

@mglagola I think you might be most familiar with how this works?

0 Likes

#3

@ide have you seen this error before?

0 Likes

#4

No I haven’t seen this error before. Not sure what could be causing it without looking into it.

0 Likes

#5

Anyone able to try:

await Expo.Notifications.getDevicePushTokenAsync()

in a standalone Android app, to see if you get the same?

0 Likes

#6

I’m fixed.
I build with SDK 20.

Bug source code is

expo/android/ReactAndroid/src/main/java/com/facebook/react/bridge /Arguments.java


} else if (argumentClass == WritableNativeArray.class) {
arguments.pushArray((WritableNativeArray) argument);
} else {
throw new RuntimeException("Cannot convert argument of type " + argumentClass);
}

argumentClass is “facebook.react.bridge.WritableMap”.
But WritableNativeArray.class is “abi20_0_0.com.facebook.react.bridge.WritableMap”.
Missmatch!!

Fixed source code is

expo/android/app/src/main/java/abi20_0_0/host/exp/exponent/modules/api/NotificationsModule.java

[Add] import abi20_0_0.com.facebook.react.bridge.WritableMap;
[Add] import abi20_0_0.com.facebook.react.bridge.Arguments;

and

[Remove] com.facebook.react.bridge.WritableMap params = com.facebook.react.bridge.Arguments.createMap();
[Add] WritableMap params = Arguments.createMap();

OK?

0 Likes

#7

@miho7031 did you fix this in your own ExpoKit build, or is this fixed upstream in regular Expo?

0 Likes

#8

It’s fixed Own ExpoKit Build~

0 Likes

#9

Anyone know if this is fixed in Expo SDK 21? Getting same error as @joenoon.

I have not detached, nor am I using ExpoKit.

Error coming from this file (Line 61):

https://github.com/expo/expo/blob/master/android/app/src/main/java/abi18_0_0/host/exp/exponent/modules/api/NotificationsModule.java

Thanks.

0 Likes