I've updated the GalleryPlugin to the Cordova 2.2.0 API but I've realized that I've never really talked about it. The GalleryPlugin is used when you need to add or remove a file from the Gallery or Music apps. Typical use cases include downloading an image from the internet and wanting it to show up in the Android Gallery app or conversely you delete a file and you don't want the dreaded black rectangle to be left in the Gallery app.
First lets take a look at what the gallery.js file. It's written using the cordova.define template but it still adds itself into window.plugins for those of you using the old style plugins:
Then will move on to the Java code. I've trimmed down code only to show the execute method for brevity.
In order to use this plugin you'll need to include the gallery.js in your HTML as a script tag:
and add a line to res/xml/config.xml to tell the JavaScript side where to find your Java class:
Now you should be able to add and remove images from the gallery. Here is some sample code to get you going:
Thursday, January 31, 2013
Sunday, January 27, 2013
Books I've Read This Week
Once again Bujold delivers some great characters and a rousing funny story. The best part about this saga is that the books are pretty much stand alone and can be read in any order. |
In the book Trent McCauley gets his family booted off the net. So in typical teenager thinking he decides to run off to the city, London in this case. There he falls in with squatters dumpster divers and makers of all sorts. Hilarity and predictably railing against the government ensues. |
PhoneGap Plugin Updates to BarcodeScanner and AppPreferences
I've updated the BarcodeScanner and AppPreferences to use the Apache Cordova 2.2.0 API's. That means no more deprecation notices in the Java code and the JavaScript code uses the cordova.require method. However, I'm still slapping the objects into window.plugins so you shouldn't need to change any of your JavaScript code after upgrading.
The BarcodeScanner code has also been updated to use the ZXing 2.1 library. If all goes well there I will contact Ryan over at PhoneGap Build to pick up my changes.
Next up will be the GalleryPlugin. The only thing holding it up is that I want to add a remove method to go along with the add.
The BarcodeScanner code has also been updated to use the ZXing 2.1 library. If all goes well there I will contact Ryan over at PhoneGap Build to pick up my changes.
Next up will be the GalleryPlugin. The only thing holding it up is that I want to add a remove method to go along with the add.
Monday, January 21, 2013
PhoneGap Plugin Updates
In the past few days I've spent some time upgrading my plugins so they work in PhoneGap/Cordova 2.2.0 or greater without requiring the users to make any changes. I've done the FtpClient and VideoPlayer. Basically I'm removing any deprecation warnings by moving from the org.apache.cordova.api.Plugin class to the org.apache.cordova.api.CordovaPlugin class. Also, I've been moving to the cordova.require way of defining a plugin on the JavaScript side while retaining the old window.plugins object for people who've written their code to use this object.
I'm currently running a poll to see which of my plugins should get upgraded next so go please vote for your favourite:
I'll start picking them off as I have time this week.
I'm currently running a poll to see which of my plugins should get upgraded next so go please vote for your favourite:
I'll start picking them off as I have time this week.
Sunday, January 20, 2013
Books I've Read This Week
What you are going to get is an engaging and sometimes thought provoking novel in which autonomous drones are killing people all over the world. After a few scenes of the awesome power of the drones we are introduced two our protagonists. A military organization who's mission is to figure out who is behind the drone strikes and a myrmecologist who's ant behaviour algorithms may be being used to give the drones a type of intelligence. The cons of this book are that it is short and I found that the story itself was no where near as interesting as the questions it posed. I found myself spending more time thinking about whether or not drones should ever be used without a human intelligence overseeing the entire operation. As a software developer I realize how easy it is for bugs to crop up in the system. |
So that's the setup. The execution is excellently done. It follows a number of main characters in various parts of the galaxy and I'm yet to determine how their stories relate. Honestly, I can't accurately judge this book until I read the next two in the series. |
Thursday, January 17, 2013
Carbonite Backup
Look this is kind of an ad and kind of a public service announcement. If you are not backing up your computer you really need to be doing that. Something will go wrong. Those hard drives don't live forever.
If you are not following the 3-2-1 backup rule then you are either:
a) being and idiot or
b) playing with fire.
Maybe both. What? You don't know what the 3-2-1 backup rule is?
Simply put:
3) You should have three copies of any important file.
2) Those copies should be on two different media types.
1) At least one copy should be off site.
For instance, all of those digital pictures of my daughter growing up are super important to me so I employ the 3-2-1 strategy for all of my picture files. I have copies of the files on the hard drive of my computer, the NAS drive that runs on my network and finally a copy offsite with Carbonite.
Now Carbonite is great tool for doing offsite backups. For $59 a year you get unlimited backup of your computer. The best thing is that it runs as a background task on your computer and you never have to think about it. Don't worry about it sucking up all your bandwidth when you want to get something done as it will throttle itself if it detects you are doing something else.
Right now if you follow my referral link you can get Carbonite and both of us get $20 Amazon.com gift cards. Also, there is a 15 day free trial so you can give it a try without committing any money.
Carbonite is the reason I didn't start freaking out when my NAS died as I knew I had a backup copy in the cloud.
If you are not following the 3-2-1 backup rule then you are either:
a) being and idiot or
b) playing with fire.
Maybe both. What? You don't know what the 3-2-1 backup rule is?
Simply put:
3) You should have three copies of any important file.
2) Those copies should be on two different media types.
1) At least one copy should be off site.
For instance, all of those digital pictures of my daughter growing up are super important to me so I employ the 3-2-1 strategy for all of my picture files. I have copies of the files on the hard drive of my computer, the NAS drive that runs on my network and finally a copy offsite with Carbonite.
Now Carbonite is great tool for doing offsite backups. For $59 a year you get unlimited backup of your computer. The best thing is that it runs as a background task on your computer and you never have to think about it. Don't worry about it sucking up all your bandwidth when you want to get something done as it will throttle itself if it detects you are doing something else.
Right now if you follow my referral link you can get Carbonite and both of us get $20 Amazon.com gift cards. Also, there is a 15 day free trial so you can give it a try without committing any money.
Carbonite is the reason I didn't start freaking out when my NAS died as I knew I had a backup copy in the cloud.
Tuesday, January 15, 2013
Phillip Broughton on Triangulation
I haven't posted on coffee for a bit so when I heard Phillip Broughton on Triangulation I knew I needed to share it with all of you. Mr. Broughton is a nerd of the nth degree. Besides working at Lawrence Livermore National Laboratory he is the man behind Black Blood of the Earth Coffee. BBotEC is a cold brew coffee that is so strong you medically should only drink 100 ml or less a day.
Listen to a great interview with Phillip on Triangulation.
Listen to a great interview with Phillip on Triangulation.
Subscribe to:
Posts (Atom)



