I recently asked a question because I was trying to use the "capacitor-community/barcode-scanner" plugin with Ionic + VueJS. but I finally gave up. I can't get it to work.
So I decided to try Ionic Native plugin "https://ionicframework.com/docs/native/barcode-scanner" , w ith the project: "https://github.com/StarleyDev/barcodescanner-sdk31.git" , i managed to make the application compile correctly for Android 11. But look at the this strange behavior, if I call the plugin through the VUE component:
https://streamable.com/ei2lmx
It seems that VUEJS fully reloads right after I call the camera. And even reading the barcode, now that everything has been reloaded, the callbacks don't work. But if I call it directly from the console:
https://streamable.com/0yahnu
Works correctly and doesn't reload the VUEJS, i believe the problem is the same that is causing the Capacitor plugin to malfunction. Any ideias?
I tried calling "SCAN" in several ways, through the BarcodeScanner class, natively through 'window.cordova' and nothing helped me. Same result every time.
Related
I created a NativeScript 7.1 project with Angular 11 using tns create my-blank-ng --template #nativescript/template-blank-ng and then run it using tns run.
The app at first runs perfectly, but it only shows a white screen after saving changes which triggers hot reload.
Is there any way to make HMR work? Disabling HMR could be a workaround, but it's to annoying to have the app restart on each change.
I can't comment, but it seems like although they announced that it now works, with Angular it still does not.
I don't think there's any workarounds at this time. We'll have to wait...
Update: There's also an issue on this at: https://github.com/NativeScript/nativescript-angular/issues/2243
Update 2: Fixed, see accepted answer.
It's a bug - fixed in nativescript-angular#11.0.1
Release note:
https://github.com/NativeScript/nativescript-angular/releases/tag/11.0.1
We are using Cordova 5.0.0 and its cordova-camera-plugin
When we are testing it on Android, the app crashes when the user takes a photo.
Looking at the links below, it seems that our app is being killed while the camera app it on front.
PhoneGap camera restarts the application
https://github.com/shaithana/cordova-plugin-wezka-nativecamera
While there are some answers but it seems to be outdated: The foreground camera plugin is not suitable to newer devices or Cordova and other solutions didn't work for us
Does anyone have an up-to-date solution?
Try to use this forked cordova-android and cordova-plugin-camera.
The docs, sample and discussion on the approach used can be found in the cordova-android PR.
BTW, the PRs are going to be merged soon.
First question that comes to my mind is: Why using this camera plugin: https://github.com/shaithana/cordova-plugin-wezka-nativecamera
It's obviously a fork. You might have a good reason for that. It's also outdated. Last contribution was one year ago.
Maybe you want to give the "official" plugin a shot:
https://github.com/apache/cordova-plugin-camera
Going deeper into detail without knowing more about your testing environment (which device(s) with which Android version) and without having possibility to review entire related code, is not possible and answers may not give any reliable advice for change.
Have you ensured, that the call to the camera plugin cannot happen before "deviceready" was triggered? Is cordova.js loaded?
Update:
You may also want to switch from raw alerts to console output. I recognized several times that alerts in callbacks triggered from plugins could cause some trouble.
As a general rule of thumb: Use console.log() instead of alert() and connect with Chrome (chrome://inspect) to the emulator or device to see what happens. You can additionally use adb logcat to have a look into the device log.
i got a webapp build via flambe/haxe which is wrapped by phonegap build to get an .ipa and .apk. For now the only remaining error is that the app looses its context if i switch between apps or pressing home-button resulting in the following error on android:
"W/Adreno200-EGL(31381): <qeglDrvAPI_eglSetBlobCacheFuncsQCOM:5575>: EGL_BAD_PARAMETER"
"E/libEGL(31381): eglSetBlobCacheFuncsANDROID resulted in an error: 0x300c"
"E/SurfaceTexture(31381): [unnamed-31381-1] updateTexImage: invalid current EGLContext"
"E/CanvasTexture(31381): unexpected error: updateTexImage return -38"
The last two lines keep repeating (even after several minutes) until i close the app manually which results in the following error-message:
"E/libEGL(21636): call to OpenGL ES API with no current context (logged once per thread)"
Full errorlog can be viewed here: http://goo.gl/UkxwfI (Dropbox)
One thing that keeps bugging me is the following message since all "related" problems got that feature turned ON, but i cant find anything to change that.
"D/webcoreglue(31381): netstack: Memory Cache feature is OFF"
Another thing is with: D/CordovaActivity(31381): CB-3064: The errorUrl is null
As of http://goo.gl/qZWc4F (github) there seems to be a problem on resuming in cordova. (just strg+f "cb-3064")
Took me the whole day to use google on terms like:
EGL_BAD_PARAMETER, qeglDrvAPI_eglSetBlobCacheFuncsQCOM, SurfaceTexture, CanvasTexture, updateTexImage, invalid current EGLContext, eglSetBlobCacheFuncsANDROID, error: 0x300c, OpenGL ES API
but without any good hints or helpful info.
additional information:
tested on Sony Xperia J (ST26i) and android 4.1.2
min android SDK 14
android:hardwareAccelerated="true" (default since sdk 14)
landscape + fullscreen
webview used to display the website coming from flambe/haxe
used build phonegap / phonegap 3.3 (using 2.8 - 3.3 = same)
building it myself via cordova doesnt help (so it should not relate to phonegap build)
cordova.inappbrowser only used to open links in external browser, website running in webview
website only shows a html5-game (nothing fancy, just something like bejeweld)
Maybe there's some easy help by juggling with the Android-Manifest. I really dont want to do native since the webapp is shipped to iOS via Phonegap too.
Update 1
Tried to reproduce the error using native android and playing with different manifest-settings. But it seems like this has something to do with how phonegap/cordova handles the drawing of everything on screen.
Next things to do will involve posting on phonegap-forums and checking out iOS errorlog. Maybe i find something while comparing my results to: iOS app crashes on resuming
Update 2
iOS-Errorlog doesn't help. Exception Type 20 and Exception Code 8badf00d. Stack shows errors with graphics too (like in android). Errorlog see Link in Comment...
"Fixed" by building android and ios myself with cordova. Resuming/Restarting feels a bit bumpy but thats the next thing to fix.
Phonegap build just doesn't like the life cycle of apps.
I've downloaded PhoneGap and tried it. It works well with some html pages + js script.
However, I have an issue while trying to access to my "full" application, with all the javascript and html pages...
The error is the following :
The connection to the server was unsuccessful.
(javascript:
try{
cordova.require('cordova/channel').onDestroy.fire();
} catch(e) {
console.log('exception firing destroy event from native');
};)
Any idea why it's happening?
Thanks for your time.
Think you have a similar issue to this question: Phonegap cordova 2.7.0 error when pausing app
I had the same problem, and like they suggested, switching back to version 2.4 fixed it.
I think I've found the change that was included in 2.5, which caused the problem. I've added a comment at the affected line here:
https://github.com/apache/cordova-android/commit/cb192056f82e051a05bbda8b09ac01a118c39838
Hopefully someone who works on Cordova will get it fixed soon.
when I include cordova-2.2..0.js in my phonegap application , it exits after a sec of loading index .html. though process keeps runing. just gui disappears ... have no clue how to approch the problem. works fine in emulator but crashes on actual device.
First check that your cordova.js is loaded before jquery.js and jquery_mobile.js
If last point didn't help strip your code and make a basic page
If you still have a problem then your Cordova project has an error. Maybe a badly loaded plugin or you didn't set your project correctly (common problem).
If point 2. solved your problem check your js code, mainly parts using cordova/phonegap framework.
Have you used this line:
navigator.app.exitApp();
if answer is yes comment it and try again