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
Related
When I build my Cordova app sometimes the correct HTML and CSS is displayed but other times I'm missing entire HTML blocks and css files. I've tried building multiple times and running on Browser/Device but it still shows the old app. I've also tried deleting the platforms folders re-adding the platforms and then building but still no luck.
Anyone had this issue and know how to solve it?
Empty the browser cache and then restart the browser.
I created a hybrid project which creates a default 'Hello Worklight' page which successfully runs on the android emulator... Now i replaced the default HTMl page with a different page along with its css and javascript folders... I rebuilt the project... It builds without any errors... But when the apps launches in the emulator....the app is just stuck on the IBM logo... I can see no errors in the logcat, that is why i cant figure out whats the problem... Do i need to modify something when i replaced the default HTML age? Help please....
You cannot simply "replace" the contents of index.html with some other content.
The file MUST contain the following:
Reference to css/main.css in the HEAD
References to the following in the BODY
js/initOptions.js
js/main.js
js/messages.js
Without these (and especially initOptions.js and main.js), the app will indeed get stuck on the splash because you will fail to load the Worklight framework, so nothing will work...
Instead, you need to ADD to it (additional references, content, etc).
Explain what you're trying to accomplish...
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.
I just excavated a maybe 3 months old Phonegap (for Android) project from my archives. Since I always had little problems with the sound API (sounds playing twice or not stopping - the rest was working just fine) I thought it might be a good idea to update to the latest version of Phonegap / now Cordova, which currently is 1.9.0. Unfortunately the app now crashes on startup (telling me it was forced to stop unexpectedly in an alert box) in all devices that I can test on (virtual and real handsets).
I guess I might have forgotten something in the update process so I'll just list what I actually did during the update:
replaced the JAR file to 1.9.0
replaced the JS library to 1.9.0 (and replaced the reference in the index.html
Edited my AndroidManifest.xml to match this page
Replaced the plugins.xml content with the new version
Replaced the phonegap.xml in the resfolder by the new cordova.xml
changed the imports in the main AppActivity.java file
Updated the all the SDK packages in Eclipse
Somehow this doesn't seem to suffice.
Did I just miss something that still needs to be done or is this some problem with something that I am doing inside my app? I didn't use any Cordova API except for playing Sounds.
minSdkVersion is 8 by the way.
Ok, so what did the trick (kind of) for me was to create a new Project in Eclipse, set it up the exact same way and just incorporate my www folder into the new project.
The two projects look exactly the same but lord only knows that I probably have missed something. In case anyone still has input on this, don't hesitate to share it!
I just upgraded to PhoneGap 1.0 and jQueryMobile Beta 2 and it seems like file:// navigation is totally borked. I've posted a super stripped-down 2 page example for Android 2.2 here: https://bitbucket.org/uhlenhuthm/pgdemo/overview
DETAILED PROBLEM DESCRIPTION:
I've created a very simple 2 page test application in PhoneGap 1.0 for Android. In my assets/www folder, I have two files: index.html and hola.html. PhoneGap loads the index.html file which contains a single button (see below). Clicking on the button SHOULD load a new page (no AJAX loading), but instead the button just changes color while being tapped and nothing else happens. This only happens when the link has data-ajax="false". Setting data-rel="external" actually has no effect and JQM loads the page using AJAX (another bug). AJAX loading works fine, but that's not what I need (for a more complex project). Including the phonegap.min.js file doesn't fix the problem either.
The weird thing is that this works in the browser (not going through PhoneGap on the phone, it goes to hola.html no problem). Maybe there's something weird with how JQM and PhoneGap deal with file:// URLs?
Am I making a bonehead mistake or is there something really wrong here?
Attempt to give this a read. He points out many different issues with upgrades, this being one of them. Here is a quote detailing what probably is causing this issue: "If you are unable to open a second html page in your app then you're missing the following tag which should be placed in the application tag of your apps AndroidManifest.xml:"
<activity android:name="com.phonegap.DroidGap" android:label="#string/app_name" android:configChanges="orientation|keyboardHidden"><intent-filter></intent-filter></activity>
I hope this helps!