Ajax error after update apache cordova to 5 - android

I have just updated my app to version 5 of apache cordova, but now I keep receiving: 404 (Not Found) on my AJAX requests, I also checked config.xml and access origin parameter is *.
Can someone help me?

Seeking a solution to the problem, I found a answer in documentation, I just install the new cordova-plugin-whitelist and the problem is solved.

After update to the Cordova 5 if you develop on Android platform version 4.0 you should add cordova-plugin-whitelist plugin.
Now by default all network requests is blocked. You could use CSP(Content Security Policy) to specify which resources allowed to access by webpage inside Cordova App.

Related

Cordova Android CORS crypt-file plugin

I am currently developing an Android application with Cordova and am trying to use the following plugin, to encrypt the source files.
https://github.com/tkyaji/cordova-plugin-crypt-file
While iOS is working fine, on Android I get the following error.
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
Without the plugin, everything is working fine. I do have the CSP set and am also using the whitelist plugin where I have added localhost in my config.xml. I have searched for quite a while now, but all seem to be solving the problem with whitelisting, which is not working for me.
I am currently using Cordova 5.4.1
Any help/idea would be appreciated.
Best regards
Runned into the same problem, solved this by allowing localhost request on the server for that specific action.
header("Access-Control-Allow-Origin: http://localhost");
See also the github issue: https://github.com/tkyaji/cordova-plugin-crypt-file/issues/4

Cross-origin Resource Sharing in Android via Ionic and Cordova

My issue is similar to this question.
I have an HTML5-based Android app. It is wrapped in Cordova, and built using the Ionic Framework. When launched, the app loads an index.html file, which is located locally on the device and makes a cross-origin resource request. It therefore does not load for Android API 18 and higher.
The workaround to this restriction is to enable the setAllowUniversalAccessFromFileURLs setting. Given that my project is built using the Ionic Framework, what would be the correct way to enable this flag? Would I necessarily need to go into the Android project to enable the flag, or is there a cleaner way to do it via a settings file?
I have inherited this project and have very little experience with Ionic, Cordova, and HTML5, therefore any detail would be greatly appreciated. In the question above, the solution was to update to Cordova 2.8.1. I am running Cordova 5.1.1. and still experience the problem.
Can be a origin problem try to whitelist your remote domain.
Read this http://docs.phonegap.com/en/4.0.0/guide_appdev_whitelist_index.md.html

PhoneGap Developer App Download Error

I'm using the PhoneGap Developer App to instantly test my apps and since tonight the app says 'DOWNLOADING', and then a few seconds later is says 'DOWNLOAD ERROR'. After that, a popup appears saying
Unable to download archive from the server. Please upgrade the PhoneGap CLI or check your network settings.
So, how do I upgrade the PhoneGap CLI and what settings should I check? I haven't changed any network settings and the PhoneGap Developer App worked fine on my Macbook and iPhone, but now it says this.
What's the problem and how do I solve it?
EDIT
I now realise that this is happening now because the PhoneGap Developer App for iOS has been updated (now version 1.5.2). I've upgraded the PhoneGap CLI to version 5.0.0-0.28.0, which is the recommended version according to this blog post from PhoneGap
Seems like there's something going wrong with the new way the Desktop and Mobile app now communicate.
THE SOLUTION:
Download the newest version of the PhoneGap Desktop App from the official website. So you have to update the PhoneGap Developer App for mobile, the PhoneGap CLI and download the newest PhoneGap Desktop App.
For me starting the local server from PhoneGap CLI helped. The thing is that for some reason using the PhoneGap Desktop doesn't fire a special Windows dialog to permit some actions for the app.
You should try to run manually in a cmd window the command phonegap serve to trigger the firewall request to open by Windows (if you are on Windows). You can also see the log. Leave the window open.
I changed the port from 3000 to something else and it worked.
Probably had something else listening to it.
While using WiFi, Your computer & device has to be on the same network.
I got the same problem and fixed it updating the phonegap.
Update your phonegap npm update -g phonegap or sudo npm update -g phonegap if root is required.
Also update your Phonegap CLI in your mobile.
I had to install node.js and it's working now.

PhoneGap Plugin (BluetoothSerial) doesn't work

I'd like to create a PhoneGap App and open a connection to another device through Bluetooth (https://github.com/don/BluetoothSerial). I started with the sample projects but nothing seems to happen with my settings, no events are triggered / console shows nothing.
I'm new to Phonegap and after struggling for days with installing NodeJs, Cordova (4.0.0), Phonegap (3.6.0-0.21.19), Ant, getting new Java JDK (1.7.0_71), updating Android (23, target here is Android API19) I can build and run Android apps. I followed http://www.pycode.com/android/creating-a-phonegap-cordova-3.0-app-in-eclipse.html as installation guide.
Nevertheless I couldn't build the jar file for Cordova (Target "jar" is not found), paths are set correctly. I searched online but the existing posts didn't help. Actually I found out that it's better to just use the CordovaApp-CordovaLib as a library, so I used this instead. Anyway it seems like I can't use any plugins at the moment (added in config.xml and gave Bluetooth permission in AndroidManifest.xml). I'm not even sure if this is the problem here.
Seems like many people are struggling with Phonegap and I hope somebody experienced the same issues and can help.. Thanks in advance!
Update
Figured out that the onDeviceReady method wasn't called at all. Checked for cordova.js (don't just use any!) and copied it into my C:\ProjectPath\platforms\android\assets\www folder.
Quite embarrassing, maybe that's why nobody's answered. I used the PhoneGap Developer App - of course this couldn't work. Use cordova build to build apk and test it on device..

Cordova plugin (for ver > 3) for Android account manager

I've been on this for past few days, may be because am not that strong on the JAVA side... I am trying to get the list of an android device's email accounts (or simply - accounts) using Cordova. There is a plugin available for this but it's compatible only for a Cordova app with version less than 2.9.
So, I built a new plugin with the instruction available at phonegap website and hosted this plugin on the GIT. While adding this to my project, I receive errors related to the JS and also, my main JAVA class - accountmanager shows an error at the "Context".
Can anybody help me looking at the plugin I tried to bring together with the help of this SO question and phoengap's plugin development guide...
Is my plugin a complete one at all? Kindly guide me..
UPDATE:
I updated my JAVA and javascript files, and now when I add the plugin, I get a new error -as follows -
Uncaught module com.am.accountmanager.accountmanager already defined : line 79 in cordova.js
Here is a working/tested plugin for retrieving an android device information - This includes every piece of information about an android device...

Categories

Resources