Cordova plugins became undefined after restoring application - javascript

I'm working on html5/css3 application based on angularjs. And building this into android application using cordova 3.5.0.
Everything works fine until I hide application using 'home' button on the phone and then restore it: after that whole app reloads, and plugins became undefined.
Any ideas why this happening and how to fix it? Maybe I need to clarify something about project structure?
I wanted to try calling plugins using cordova .exec() but this method is undefined as well.

Well, I figured out what's the problem and I feel really stupid right now.
There is an option in dev options: "Don't keep activities", I was testing application on my co-worker's device and this option was turned on(I believe it turned off by default), so it was the root of a problem.

Related

React-native facebook login crash on Android

I'm using react-native facebook login through this library: react-native-fbsdk. Following the installation guide did not completely get it working, but I managed to get it working after modifications on the native side, as instructed in many github issues etc.
Anyways, it was working fine two weeks ago, but now, when I try to login with facebook, the application immediately crashes. It doesn't open any login page or do anything else.
What is weird is that if I open a browser in the emulator, leave it to background, and then try to login, the login goes further (I get to actually login, but when I'm directed back, the application crashes).
From the tombstone files I am able to get following warnings/messages:
Expected native library version number "",actual native library
version number ""
Tens like these:
Could not find generated setter for class
com.facebook.reactnative.androidsdk.FBLoginButtonManager
How could I solve this problem? And why it doesn't work anymore? I didn't change anything in the code. Only thing I can think of is that it loads something from the internet during compiling the application. How could it otherwise fail?
This is answer for how I solved the problem, not that much about why it was behaving like this.
In short:
I got it working again by updating the emulator and android API 6.0 through Android Studio.
<Rant state='begin'>
I have no idea why this worked, nor why did it broke in the first place. As it was working good with the old emulator and API 6.0 earlier.
It seems like the react-native fbsdk is far from stable. Or then it is completely react-native's fault, idk to be honest. But this just makes me want to develop fully native, instead of react-native, which seems unstable from my experience so far.
<Rant state='end'>

How to create PhoneGap plugin out of an android application

I am basically using this https://github.com/googlesamples/android-vision with a few changes and it works perfectly on my android device.
Anyway, I would like to use it inside PhoneGap. The idea is to build the rest of the application in javascript/html/css and when pressed a specific button, start the android app.
Can this be done by someone who has never created a plugin before?
I would be grateful for any hint or tutorial on how to do it.
Of course it depends of your dev skills but I created myself my first plugin two months ago without being a Phonegap/Cordova expert, I'm a Java developer since 15 years but the most important thing is your motivation.
You first have to develop your basic Cordova app:
https://cordova.apache.org/docs/en/latest/guide/cli/index.html
Then your ressource to create a plugin will be here: https://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html
You will have to create one or few Java files as an adapter between your web app and your Jar code.
I found that the documentation was not enough for my case but I googled and used some dev blog articles and found some StackOverflow questions to help me.
Good luck!

Cordova iOS plugins failing to load

I've been developing a cross platform application which until recently has caused a few headaches. Android release will load the plugins without any issue at all, however, the iOS seems to have drop. I am unaware if it's something to do with the latest release of iOS (8.2) or something which has caused an issue in a most recent cordova update. Hopefully you guys would be able to shed some light on the matter.
I'm using jQuery Mobile, I've found an article while browsing through Stack Overflow that setting changeHash to false will counter act getting the message Resetting plugins due to page load. unfortunately it didn't work
$(":mobile-pagecontainer").pagecontainer("change", "#questions", {changeHash: false});
Another article I've found is that they simply tell me to ignore it, but something tells me not to do that.
In summary, all is well on Android, every plugin which I have installed is working without issue. On iOS non of the plugins are loading, and simply typing window.plugins should bring back an object of plugins but it's undefined. I've inserted a try catch to find the problem and this is the error which I am getting.
getQuestion: undefined is not an object (evaluating 'window.plugins.captureplugin')

AngularJS and TideSDK

I am trying to implement, an AngularJS App, to work with TideSdk. Everything works fine, if I run it over the browser, but however, I am not seeing any element loaded when I package it as a TideSdk application. The template is not even loading.
I don't find any useful as an error in the console.
Has anyone tried it before.?
I'm currently working on a project which is Angular based with TideSDK, and it's working well. All my routes, directives, services, (...), are working. Could you explain a bit more your issue?
Did you enable the webkit console of the app ? (https://github.com/TideSDK/TideSDK/wiki/Enabling-Web-Inspector => for macos)
All the logs are not present in the TideSDK Developper tool.

PhoneGap Android Querystring issue

I seem to be having a issue using phoneGap with querystrings
I wanted to have a page as:
view.html?matchid=1234
I have also tried:
view.html#1234
Both of these work in the emulator (running 2.3) but neither work when on my phone (ICS 4.0) - It errors as if the page doesn't exists...
I believe it may be a issue with the version of android. Does anyone know of a fix/work around I could possibly do.
Ideally it would be still using the query in some way. If not the other option I thought of was to use localStorage. Save something to it before going to a generic view.html page which then takes the Id out of localStorage....
There is an issue for this in the Android issue tracker.
http://code.google.com/p/android/issues/detail?id=17535
It affects all versions of Honeycomb and ICS.
It has been fixed and marked for Future release, so don't expect it anytime soon.
You can find some workarounds on the issue thread.

Categories

Resources