Both iOS and BlackBerry support the PNG image format so I added support for Android.
Also, iOS and BB use targetWidth/targetHeight to specify the resolution of the image. I've swiched from using maxResolution to targetWidth/targetHeight in this change list.
Calling Media.seekTo() now updates the Media._position value. I could not make seekTo() to work when your audio clip is not playing as that is not a supported action of the AndroidMedia player class.
Currently the implementation will return an empty array for the following Contact attributes: phoneNumbers, emails, addresses, ims, organizations, addresses, websites and photos. With this fix these attributes will be null unless the lenght of the array is greater than 0.
Sometimes Android will hand you a content:// uri in the place of a file path. Particularily the Camera.getPicture() code will do this. I've updated the file utils code to handle this type of uri and return a real file path.
Instead of capturing the orginal image to /sdcard/Pic.jpg or /sdcard/Capture.jpg we detect if the SD card is mounted. If mounted the file is placed in the apps temp directory at:
/sdcard/Android/data/{package name}/cache/
If the SD card is not mounted we default to internal storage at:
/data/data/{package name}/cache/
Right now we are just removing the code for Contacts on 1.5/1.6 devices. We still need to keep around our implementation of Geolocation and Storage for older devices since some versions of Android have broken implementations of these features. Android 3.0 I'm looking at you!
Adding better test to see if a directory is being moved/copied into itself.
Copy /sdcard/myDir to /sdcard/myDir-backup is okay but
Copy /sdcard/myDir to /sdcard/myDir/backup should thow an INVALID_MODIFICATION_ERR
- Replacing currentNW and homeNW with networkName.
- Changing Connection constants to strings instead of ints.
- Firing online/offline events on network change.
I could not get rid of the url encoding and decoding without hampering some users ability to pass non-ascii characters back to JavaScript. However, I was able to reduce the amount of data being passed from Java to JavaScript by 40% by decoding common characters that occur in JSON and XML. These characters will survive the round trip just fine and don't need to be encoded.
This is the best solution I could come up with. You won't be able to read files as large as you could in 0.9.4 but it will get close and it will support non-ascii characters.
I did my best to clean up the JavaScript so it would pass through jsHint more cleanly. There still are issues but there are a lot fewer now. This helped to make the JS code more consistent.
Android 2.2 introduces the navigation.connection interface but it does not work properly in WebView. So in order to get the proper connection information we had to implement our own connection interface which is accessible at navigator.network.connection.
Issue #82: The RandomAccessFile class in Android's version of Java does not write non-ASCII characters very well. I've switched to using a FileOutputStream which seems to work just great. Tested by myself and folks from Egypt and the Netherlands.
Issue #87: Fixed a problem where the file errors were being returned as evt.target.result.code.code.
The way were were detecting we were on an Android 3.0 device was not applicable for Android 3.1. I've made and update so that any Android 3.X device will use our implementation of web sql databases instead of the built in one which thows a security error.
The FileEntry.createWriter() method passes in a FileEntry object instead of a File object. As a result the FileWriter.length was not being set properly so when you do a writer.seek(writer.length) it would go to 0, so your next write would overwrite your file.
In order to fix this issue the FileEntry.createWriter() method now makes a call to FileEntry.file() to get the correct file size. The File object is now passed to the FileWriter constructor.
For Android version 2.2 or better the navigator.connection object already
exists. If this case we should immediately fire the onPhoneGapConnectionReady
event so we don't tie up the 'deviceready' event.
Adding a new object to navigator called 'connection'. Users can query the
connection object to find out what type of network, if any, the device is
connected to. The connection object will be updated each time there is a
connectivity change on the device.
Renaming supportedAudioFormats to supportedAudioModes.
Renaming supportedImageFormats to supportedImageModes.
Renaming supportedVideoFormats to supportedVideoModes.
Adding copywrite header to the Capture.java file.
Contact search was not working for unicode letters. The CallbackServer was changed so that it returned url encode strings. On the JavaScript side the PhoneGap callback handler decodes the returned string.
When you call window.openDatabase() on an Android 3.0 device you get and error something like this:
E/Web Console( 1791): SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent.
Simon worked with Pat for a bit and they think this is a WebKit or Android/WebKit interaction bug. In the meantime this fix determines if you are on Android 3.0 and uses Droid_DB if so.
(for such SQL as e.g. CREATE TABLE).
It is especially important when work with dome 3d party persistemce
libraries, like e.g. http://github.com/zefhemel/persistencejs which
passes these nulls.
An implementation of the W3C Media Capture spec:
http://dev.w3.org/2009/dap/camera/Overview-API
Capture operations are supported for audio, video, and images. Each
capture operation launches the native audio recorder, video recorder,
or camera application, respectively.
A standard from has no trailing whitespace after a content-disposition line like so: "Content-Disposition: form-data; name="data";" however when using the extra params of Android FileTransfer a space is added on the end "Content-Disposition: form-data; name="data"; "
This fix simply removes the trailing whitespace.
PhoneGap 0.9.4 replaced PluginManager.addService() with navigator.app.addService(). This is problematic with the older plugin as they are not being maintained. I'm adding in a PluginManger JavaScript class which will implement the addService method and call navigator.app.addService() method under the hood. This way we won't break old code.
FileTransfer returns FILE_NOT_FOUND_ERR on http 500 error
For some reason on Android if you do a getInputStream() on a HTTP Connection and the server returns a 500 error it will report a FileNotFoundException. Catching this exception and throwing an IOException so that we can report a more accurate error in JavaScript.
http://www.w3.org/TR/file-system-api/
User can retrieve PERSISTENT and TEMPORARY file systems, list their
contents, and manipulate files and directories within them.
Modify existing FileWriter implementation
-----------------------------------------
- Change the way user creates a FileWriter. User must either pass a
File object to the FileWriter constructor, or use the
FileEntry.createWriter() method.
- Drop support for the 'filePath' and 'append' parameters in the
FileWriter constructor. The file path is determined from either the
File object passed to the FileWriter constructor, or the FileEntry
object used to create the FileWriter. To append to a file, use the
FileWriter object's seek method:
// writer is a FileWriter object
// seek to length of file to append
writer.seek(writer.length);
Replace FileMgr JavaScript APIs not specified in any File API spec
------------------------------------------------------------------
- Remove navigator.fileMgr.createDirectory(dirName) function. To
create a directory, use the DirectoryEntry.getDirectory() method,
which is part of the File API: Directories and System spec. Set
the Flags.create to 'true':
// directory is a DirectoryEntry object
directory.getDirectory(path, {create:true}, successCB, failCB);
- Remove navigator.fileMgr.getRootPaths() function. To retrieve the
root file systems, use the window.requestFileSystem() function,
which is part of the File API: Directories and System spec.
- Remove navigator.fileMgr.getFileProperties(fileName) function. To
get the properties of a file, use the FileEntry.file() method, which
is part of the File API: Directories and System spec.
- Remove navigator.fileMgr.deleteFile(fileName) function. To delete a
file, use the Entry.remove() method, which is part of the File API:
Directories and System spec.
- Remove navigator.fileMgr.deleteDirectory(dirName) function. To
delete a directory, use the Entry.remove() (if it is empty), or
DirectoryEntry.removeRecursively() methods, which are part of the
File API: Directories and System spec.
Clean up existing FileManager native code. Move some functionality to
file utility class.