Personal Blog for Joe Bowser

Trail a Week - Jug Island

I made a new year's resolution to hike a day trail a week, so that I gain experience and stamina for those longer hikes in the backcountry, assuming that I get a chance to do overnight hiking this year. I decided to start the year with a trip to Jug Island in Belcarra. It's relatively close to my house, and it's a moderate trail. I managed to get it done in 1hr 30 minutes according to MyTracks. I did stop and take a bunch of 360 photos along the way, but most of them turned out badly. The ones that did work out well were the ones where I put the 360 camera on a wooden post.

Because I'm lazy, and because I have 360 photos involved, you can find the Google Photos album here

It'll be interesting to see how long I can keep up the hike-a-week thing, and whether work will end up getting in the way. I'm going to be uploading the good 360 photos that I took to Google StreetView, but I'm interested in some better solutions to the Giant Hand/Giant Tripod problem that I'm running into when I use the Ricoh Theta S. I'm finding that I want something more high-res already, but I feel that I need to use this camera more and get used to doing photos and video with it before spending money on much pricier equipment.

Written By

2016 - Time for Adventure

I haven't written anything here in quite a while. Here it goes!

I'm going to be doing two new things this year:

  1. Try to hike one trail a week - This will probably be uneven. I already failed this week to hike a trail, but I will probably start next weekend.
  2. Get into 360 degree photography/videography - I've been playing with Google Cardboard, and so far I find the 360 video and photo stuff far more interesting than yet another VR landscape that people seem to be intent on showing me. I'll talk about that more at length
  3. Go on more camping trips - This is something that happens EVERY year.
  4. Start playing with Drones - This was another thing that I wanted to do last year, but didn't have the money for
  5. Buy a 3D Printer - Again, something that I'm lagging behind on

I'm sure there's others, but that's the basic list of it. I'll probably go more indepth of what exactly I'm doing but for now, I'm just going to put this out there.

Written By

Cordova Android 5.0.x plugin changes.

This is a post that will most likely end up on the Cordova blog. This will be posted here first.

Google has released Android 6.0.x on devices, and if you are an application developer, you should be worried about the following scenario.

This is an application crashing because some user decided that the application shouldn't have access to contacts. Why does this app need contacts anyway? So, instead of removing functionality, or losing users, you should gracefully handle permissions in your application, and this will tell you how the latest version of Cordova can do this. It should be clear that the only thing that we added to Cordova 5.0.x is the ability to handle these permissions, and nothing else should break with these changes. We've decided to keep the number of API changes small, and we did not remove any API calls in this release, since we know that major versions are likely to scare our users, and we want to try to avoid doing that this time. This is nothing like the 4.0.x change that we did earlier.

So, to get started, as an application developer, you will need to implement the following method:

    public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults)

We also added this method for most permission checking:

    public void requestPermission(CordovaPlugin plugin, int requestCode, String permission);

These methods must be implemented if you're implementing a Cordova Interface, but assuming that you're inheriting the CordovaInterfaceImpl class, this should be no problem. This allows for a plugin to request a permission. Right now, we don't have helper methods for checking permissions, and that has to be implemented manually as follows.

    private boolean hasReadPermission() {
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
            return PackageManager.PERMISSION_GRANTED == cordova.getActivity().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
            return true;

We're assuming that unless you're on Marshmallow, you already have the permission, since you should have already have it declared in your AndroidManifest.xml, which would be populated with the entry in your plugin.xml. However, you still need to handle these permission changes in your plugin. The basic flow for a plugin is as follows:

  1. Plugin checks for permission
  2. If the plugin doesn't have the permission, it requests the permission from Android
  3. Android prompts for a permission.
  4. Android then passes the permission to the Activity, which then passes it back to the plugin

  5. onRequestPermissionResult then processes the result

It's important that you setup various request codes, and ideally they should be enumerated to match the plugins that you are requesting. This will then allow you to continue the execution of the method. Of course, this may require the refactoring of the methods in your exec call.

It also should be noted that not every plugin is affected by this, only plugins that use what Android describes as dangerous permissions are affected. The list can be found here. Another thing that should be noted is that if you grant READ permission on a particular permission group, you will also be granting WRITE permissions on that group by design. Therefore, you may want to convey why you need access to the feature to begin somewhere else in your app, in addition to doing the due dilligence required in securing your application

Written By

Older ›