Exception firing destroy event from native - android

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.

Related

Opening the camera with Vue + Ionic causes a reload

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.

Ionic Searchbar Doesn't Work

I faced off a problem that I can't solve. I've searched on the web before posting this but I found nothing really useful for me.
Straight to the point. This is the problem, I have a ion-searchbar that does not receive keyboard input in Android device. I run that with ionic cordova CLI and the build was successful.
Please help me, all the other features of the app work well, I only have to fix this.
<ion-searchbar [(ngModel)]="searchedText" [showCancelButton]="shouldShowCancel"
(ionInput)="onInput($event)" (ionClear)="onCancel($event)"></ion-searchbar>
That searchbar does not receive any character of my keyboard input.
If I run it on local with ionic serve it works instead.
What could be the problem?
Found the solution.
I put that searchbar in ion header instead of ion content. I changed that and then it worked.

including cordova.js exits my application

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

Issue with using LocalStorage in PhoneGap for Android

To resolve : Application error - A network error occurred. (file:///android_asset/www/messagedetails.html?Id=29) in Android 4.0,I am using LocalStorage.
This approach gave me the solution for the problem.But when the App is not run for long time or kept on hold., I am facing the issue again.
I am not able to navigate from one page to another page. :(
I added the code to clear the App cache , is it the right approach???
Thanks in advance.
I do believe you are experiencing the "Unknown Chromium Error -6" issue. It's a known error in the Android 4.0 release that the file-URL can't contain parameters. (See further here: Android 4.0 Issue). There are a number of possible solutions;
Redesign to use LocalStorage for passing parameters around.
Upgrading PhoneGap to 1.7+ (Cordova), seem to solve the issue. I haven't tried.
Hope it helps.

window.location.reload() causes an Application Error on PhoneGap 1.4 / Android Honeycomb 3.2.1

Why does window.location.reload() === instant_fail on Android 3? I just get an Application Error popup with the file:///... URL of my application, and have to restart. I've tried overriding DroidGap.onReceivedError() but it just tries and fails to reload itself repeatedly.
I'm not sure if you still need an answer to this, but this might help someone. I encountered the same problem with PhoneGap running on Android 3. I solved it by replacing this line:
location.reload(true);
with this:
navigator.app.loadUrl('file:///android_asset/www/index.html');
A device agnostic solution would be to use:
window.location = 'index.html';

Categories

Resources