Ionic only works with ionic run android - sqlite

I have a weird issue with my ionic app, it only works when i run with : 'ionic run android' from my computer (testing) to my mobile. but when i want to run the app from my mobile it dont loads the database (i was using sqlite)
I put my code on onDeviceReady(), it is wrong? (im working without angular, only js and cordova):
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
//console.log('onload');
}
// device APIs are available
//
function onDeviceReady() {
//my main code
}
please, can you help me?

Related

NgRx store runtime check NgZone failing on android

We implemented a network check as a side effect with window event online and offline.
online$ = createEffect(() => {
return fromEvent(window, 'online').pipe(mapTo(NetworkActions.deviceOnline()));
});
This works fine in Desktop Chrome and on iOS Safari but somehow results in a strictActionWithinNgZone runtime check on Android:
{
"state": {
"keyboard": {
"isKeyboardOpen": false
},
"network": {
"isDeviceOnline": true
}
},
"error": "Error: Action '[Network] Device Online' running outside NgZone. https://ngrx.io/guide/store/configuration/runtime-checks#strictactionwithinngzone"
},
Does anybody have any idea why this only happens in Android and why it even is a problem to begin with?
Edit:
As far as I understand it, fromEvent(window, '...') should always be inside the zone because zone.js does patch all Browser EventTarget.
Also this is on an Ionic + Cordova App but only when built on Android. Only reason I could see for the difference could be in the Webview it is running in but other than that it is just basic RxJS and Angular
Thanks Pascal
It looks like this was a super specific problem with an Ionic + Cordova App and the Cordova Network Plugin https://ionicframework.com/docs/native/network
This seems to interfere with the Android Platform. Without the Plugins the Error does not occur but the online and offline window events also never fire on Android. So I guess this has nothing to do with NgRx.

Is there a way to run a flutter app on web when the app uses a plugin which is not developed for web

I am using firebase_dynamic_links in my app and I wish to deploy the app on the web. firebase_dynamic_links is not implemented for flutter web.
Now, I am using dynamic links in just one file. is it possible for me to use a separate code file just for the web version that does not use dynamic links?
The code is pretty extensive and the part consisting of dynamic links is pretty small, I don't want to maintain a separate repo just because of this.
You could simply wrap it in:
try{
// app code
}catch(e){
// web code
}
You could also try:
import 'dart:io';
if(Platform.isAndroid){
// app code
}
else{
// web code
}
Although I've found that this will sometimes throw an error on the web, so you might want to wrap it it a try/catch.
You could also do:
import 'package:flutter/foundation.dart' show kIsWeb;
if (kIsWeb){
\\ web code
}
else{
\\ app code
}

firebase.notifications().getInitialNotification() returns null in iOS

I have a React Native project and I'm using Firebase, thus using react-native-firebase npm package in my project to be able to handle push notifications. I followed the docs here. All seems fine so far except that getInitialNotification() function which keeps giving me null in iOS. Therefore, I can't check if the app is opened by notification tap. Everything works like a charm in Android though.
Any suggestions?
async componentDidMount() {
const notificationOpen: NotificationOpen = await firebase.notifications().getInitialNotification();
console.log(notificationOpen); // Outputs null
}
SOLVED
I solved the issue by using latest react-native (0.59.9 > 0.60.5) and react-native-firebase (5.5.4 > 5.5.6) versions.

Sometimes data are not loaded from sqllite in Phonegap

I am using SQLLite in Phonegap. First time once app is initialized, I am inserting all records in different tables and then use it on different pages.
On different pages i have opened database and getting data from the sqllite. But my issue is that sometimes on page it is not loading data from sqllite but as soon as i press app back button or app's back button it loads data.
Here is my code on different page on device ready. Will you please guide
var db;
$(document).ready(function(){
document.addEventListener("deviceready", getdata, false);
});
function getdata()
{
window.sqlitePlugin.openDatabase({name: "mayaa.db"});
}
AFAIK This plugin doesnot support multi page architecture. I faced this issue couple of months back. Author told me to use a version which supports multipage architecture. I used this verion and everything worked perfectly.

Why Visual Studio Cordova project always resumes while debugging for parenthesis in index.js

I've just created a vs-cordova application. When I ripple this application on chrome browser everything works as expected.
BUT,
The debugger breaks on end of cordova.js and index.js. The index.js is below. Break point hits the final bold area. But why? I do not see anything in output area.I opened CLR errors by CTRL+Alt+E ,but didn't help either. I do not see any error on js-output as well. The function is anonymous has no name.So the final parentheses seems fine, isn't it?
Now,I just hit F5 and continue.It's cool but I found this a bit annoying for a while! Especially for android target.It breaks the code for many places. Have you got any suggestion for me ?
BTW, as far as I noticed debugger firstly stops for cordova.js which is added into project when I start debugging then finds index.js.
(function () {
"use strict";
document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false );
function onDeviceReady() {
// Handle the Cordova pause and resume events
document.addEventListener( 'pause', onPause.bind( this ), false );
document.addEventListener( 'resume', onResume.bind( this ), false );
// TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.
};
function onPause() {
// TODO: This application has been suspended. Save application state here.
};
function onResume() {
// TODO: This application has been reactivated. Restore application state here.
};
} )();
This is due to an issue in our web debugging code that surfaced after a recent update to Chrome. It has been fixed in VS 2015 CTP6 that was made available recently. It will also be fixed in our next extension update to VS2013.

Resources