My Android-only app is quite simple: it loads a webview to a certain URL that I control, passing the device ID and Expo Push Notification Token as query parameters. My backend reads these parameters and then presents a login screen to the user. Once the user is logged in, all interactions happen within the webview (the web UI is responsive, etc).
I also have a static image as a splash screen. When the app is getting the ExpoPushToken, I don’t want a white screen. So, I have tried to set things up so that until the PushToken is received, the same image as the Splash Screen is loaded. Once the token is received, the app’s state changes, and the Webview gets rendered.
I am facing three issues, almost certainly due to Expo Push Notifications. These arise on the standalone apps, not on Expo Client.
On almost every device, the first time the is installed from the Play store, the app hangs for the first time. There is a slight change in the background image’s position, which is basically the transition from the SplashScreen to the ImageBackground being rendered I think. After this transition, the app is unresponsive. Once the app is closed and restarted, things work fine.
In some percentage of the apps, say 15%, the app results in the phone hanging. Again, this happens after the transition from the SplashScreen to ImageBackground. The phone has to be restarted as it becomes totally unresponsive (or so my users claim). One of the users got back to me and said that he was using a Redmi Note 4, if that is relevant. I checked on a Redmi Note 5 Pro, and the phone didn’t hang.
In some cases, I am getting the
Error: Couldn’t get GCM token for device
error for the getExpoPushTokenAsync() method. I have integrated with FCM and so on, and the notifications even work for most devices. So, I don’t think it is the setup that is the problem. I am not sure if this error leads to the behaviour in (2.) above. But, it seems like there is some correlation between the two, from user activity logs.
I have uploaded the two .js files on Snack I am pretty sure all the issues are due to the generation of the push token, and my incorrect implementation of async await, etc. Any help here will be much appreciated. Thanks!