Expo notifications can't call `getExpoPushTokenAsync()` - android

Am currently trying to setup notifications on my managed expo project
Expo version 47.0.0
Expo notifications version 0.17.0
Device: Samsung Galaxy s10
Android version 12
I am currently just trying to get the basic setup itself working and retrieve my devices push token. This should be done using Notifications.getExpoPushTokenAsync() as described here.
The Problem
My error is strange, when I call getExpoPushTokenAsync it does indeed get me the expo push token, however shortly after my app crashes with the following messages
ERROR TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[1], "../../../src/util").types.isPromise')
WARN [expo-notifications] Error encountered while updating server registration with latest device push token. [TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[5], "#ide/backoff").computeNextBackoffInterval')]
I have tried
re-installing node_modules and expo-notifications but still get the same.
I can definitely see the #ide/backoff package is installed in my node_modules.
I also followed these instructions to setup firebase in app, even though my understanding is that it should work out of the box in expo go app while devving.
One other interesting thing is that I can call Notifications.getDevicePushTokenAsync() fine with no error. But still get the same error if i pass that in to getExpoPushTokenAsync method after. At a surface level it seems like somehow the request out to expo services to get the expo push token is both passing and failing 🤷‍♂️
const devicePushTokenResponse = await Notifications.getDevicePushTokenAsync();
const expoPushTokenResponse = await Notifications.getExpoPushTokenAsync({
devicePushToken: devicePushTokenResponse,
}); // <--- Returns token & errors a few seconds later
Couldn't see any other posts with this error and expo-notifications, so would be keen to see if anyone else has ran into / fixed a similar issue recently
Cheers

Alright I figured it out, it was somewhat hinted at by this line
ERROR TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[1], "../../../src/util").types.isPromise')
And more specifically the fact that a node_modules dependency is referencing 3 levels up in the file system.
The solution
Turns out that for some reason my module resolver (defined in babel.config.js) was resolving my project's util folder instead of the packages util folder. I think this was compounded by my metro config making use of the inlineRequires functionality to improve performance (see more)
I am sure there is some actual config that could be updated to exclude node_modules from using inline requires (i did try use a blocklist to no avail), but as an interim, i was able to get it working fine by changing the path of my util folder to be #my-project/util so that it avoids future collisions.
Hope this helps anyone who runs into the same issue in the future :)

Related

Xamarin Android error on DeviceInfo.Model

I have a Xamarin for Android app that has been working until today. I needed to make a change but before I did, I ran a test to ensure no VS or Nuget package updates caused an issue. I have Xamarin.Essentials in my app and this line worked before, not sure what is happening now.
if(DeviceInfo.Model == "TC72"){scannerIndex = 1;}
Exception Unhandled:
Xamarin.Essentials.NotImplementedInReferenceAssemblyException: 'This
functionality is not implemented in the portable version of this
assembly. You should reference the NuGet package from your main
application project in order to reference the platform-specific
implementation.'
Any insight would be helpful. TIA
I changed the DeviceInfo.Model to Build.Model and get the same info I was expecting. That fixed my issue. If anyone has a different suggestion, happy to entertain them.
Added 8/11/21 3:25pm CT
I also found that changing my Compile Target to 10.0 fixed the Xamarin.Essentials issues. So far the application is working on 8.1 on the device (Zebra MC3300).

NativeScript Build - Error executing Static Binding Generator: Class not found android.support.v4.view.ViewPager.OnPageChangeListener

I'm new to NativeScript and took over a project recently upgraded from NativeScript 4 to 6. Here is my environment detials:
Windows 10
Node v16.6.1
NativeScript 8.0.2
Android Studio 11 (with al
the recommended updates to date)
VS Code 1.58.2
I can create a new Native script project with "tns create" and build/run it in the simulator just fine. However, when I try to run the project the build throws the following error:
java.lang.RuntimeException: Class not found android.support.v4.view.ViewPager.OnPageChangeListener
at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:551)
at org.nativescript.staticbindinggenerator.Generator.getInterfacesFromCache(Generator.java:534)
at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:283)
at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:171)
at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:234)
at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:121)
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:97)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:55)
Here is the run command I'm using: "tns run android --emulator"
I have tried tons of things and searches but no luck resolving this issue.
So I had an idea and searched with a different search engine than I normally use. I did find some ideas which helped me resolved the issue.
I had previously searched in VSCode for variations on "android.support.v4.view.ViewPager.OnPageChangeListener", but only found the log file with the error. Then I learned you have to change the filter options of the find in file search otherwise the files you are looking for can be excluded from the search results. I also used Baregrep to confirm I was getting everything.
I fixed the issue by replacing all occurrences of:
android.support.v4.view.ViewPager with androidx.viewpager.widget.ViewPager
Also you may need to install widgets:npm i tns-core-modules-widgets
Since the files where I made the changes were all non-project files (many of them in the node_modules directory) there is probably something else that involves updating Node or NativeScript that may solve this as well.
If someone else figures that out, I'll be watching this thread for updates, and thanks in advance!
Fissh

Unity Auth Error With Firebase

I implemented Firebase into a Unity app I am creating. There are two buttons that will run the two functions to create a new user and login an existing user. So far this functionality works on my PC, however whenever I try to deploy it to my android phone or Mac I end up getting the following error in the console.
DllNotFoundException: FirebaseCppApp-5.1.0
Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for SWIGExceptionHelper
Firebase.AppUtilPINVOKE..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Firebase.AppUtilPINVOKE
Firebase.AppUtil.SetLogFunction (Firebase.LogMessageDelegate arg0)
It appears there is a missing .dll file, however I cannot for the life of me find out how to include it within the project file. I also have double checked the package name and it is the exact same name as the one made for my Firebase project, the google-services JSON in the root of the project, and the Api compatibility level is set to .NET 2.0. On top of that I also uninstalled and reinstalled the app a few times. I also tried using the Play Services Resolver which didn't help much at all either.
Similar error here, only with Firebase Cloud Messaging. After tinkering around in a fashion similar to yours I concluded that it was caused by corruption during import of Firebase Package.
What worked for me:
Deleted each and every folder created while importing Firebase Package.
Reimported Firebase Package

React Application biqComfortApp has not been registered.due to require() error during initialisation or failure to call AppRegistry.registerComponent

Cloned the project from Git and started it with react..
Did not do any changes in the code for the project as I just wanted to run it using react..
but I got the following error in the emulator..
Application biqComponentApp has not been registered. This is either due to require() error during initialization or failure to call AppRegistry.registerComponent.
I am using windows 7 but same project up and running without any problem for colleagues with mac computers.Not sure whether it is a problem in the project with windows or any installation problem in windows..
please help to find the issue..
Error in the emulator
Make sure you don't have any other react-native/node process running in another terminal. If you do, close it and then re run it, it works for me.
or else
It could be an error caused by not matching name of project and your registered component.
You have created a project with a certain name, example:
react-native init biqComponentApp
But in your index.android.js file you register other component
AppRegistry.registerComponent('Bananas', () => Bananas);
When it must be
AppRegistry.registerComponent('biqComponentApp', () => Bananas);

return-statement with no value in function returning void: HxScout with openfl

I'm developing an app for android using openfl. I could successfully compile for android before trying to use HxScout.
But following instructions on hxscout.com, when I try to test my app with this command:
haxelib run lime test android -Dtelemetry
I get the following error:
./src/hxtelemetry/CppHxTelemetry.cpp:233: error: return-statement with no value, in function returning 'Void'
I just pushed the fix to both git and haxelib (hxtelemetry v0.3.5). I think there were issues with different versions of haxe/hxcpp wanting different styles of returns.
Anyway, LMK if it doesn't work.
Fixed in this issue here on github

Categories

Resources