My Barrathon

Take a little island of 60 square kilometers, just one main road runs around the coast, surrounded by the ocean and with an estimated population of 1174 people.
I decided to go there.
I decided to go there and run .
Reaching Barra is not so difficult but the time the travel takes can vary a lot based on the transport you decide to take.
You can reach Barra in two ways:
– by the ferryboat, starting from Oban
– by plane, yes Barra has an airport, more precisely, has the only airport in Europe where you land on the beach.
Initially I planned to take the airplane starting from Glasgow, just after the Droidcon in London, but I was too incautious expecting that would be easy to find a seat at the last moment, apparently it’s not, so I opted out for the ferry boat.
I spent the night in Glasgow and early in the morning took the train for Oban and there the ferry boat for Castlebay, the main village on the island.
I reached the island around 8PM, the ferry needs about 5 hours, the flight just 45 min, nonetheless I get the privilege to see some beautiful scenarios during the travel, I don’t regret it at all!


October is not the best month if you want to visit Scotland, why the hell did you go in the Hebrides ?
This is the kind of question most of my friends ask me, to be honest I think was a great month and moment to go, few travelers, best price for the accommodation and the pleasure to run alone without meeting anyone for hours, just me, cradled by the run, immerse into raw lands.
Everyone can have several reasons for going into a specific place, don’t leave the people change your mindset, if you want it, if you feel that’s the right thing to do, you have to do it.
I stayed at the Castlebay Hotel (my room had a perfect visual of Kisimul castle) , I booked for 3 nights but suddenly I extended that to 5 nights without problem (another advantage related to the low season).


Until two months ago I didn’t know anything about Barra, one night I was reading a book entitled “Correre nei luoghi piu’ belli del mondo” and Barra was among them, every year in June there’s a competition called Barrathon, a half marathon around the island, almost immediately I knew that would be a very nice race to do but then I thought “why don’t spend some days there, why just go for a halfmarathon when you can go and run how much you want, on the same track without the pressure of a competition?” Ten seconds after I made up my decision, every day after the breakfast I would have run on the island not only on the main road, I would have run heading towards any place I’d find interesting to explore without a specific reason, just cause I’d want to go there.
That was my only plan.


Every day I went out from the Castlebay Hotel with my backpack, some water, something to eat and no care about the weather or the wind or the cold, with only the pleasure to explore.
Usually I started to run on the main road but when I saw a beach or a strange rock on a peak or a little building I just deviate taking another direction and on Barra this is very easy cause there’s almost any place you cannot reach.

In the mid afternoon usually I was back at the hotel, after a good shower and half an hour rest I went out for a tea break in the near cafeteria where I tasted some of the best cakes I ever tried 🙂
The rest of the afternoon, just a bit of walking and reading until dinner time when the restaurant in the hotel give me some tough times but in a good way, delicious meals, was not able to contain myself 😀
I made an average of 28 km a day running, but this is not the point, the point is that there were some moments where the time stopped, around you there’s nothing besides the sea, the wind is blowing and the sea speaks to yourself and you’re truly happy just because you are there, you are living.
Thank you Barra, I’ll bring you always with me.

Droidcon London 2017

droidcon

This is my first Droidcon in London, before I had been at Droidcon in Italy so I feel safe to say that this one is probably the most famous/important android conference that I attended so far … but the real question is, does it worth it?

Now keep in mind that this is just a personal opinion, so there’s no absolute truth in it, experience may vary from person to person overall there are some points that are undoubtedly, unquestionable facts, ergo there’s anything to argue about them, cause they are well … facts 🙂

Let’s start to examine every single main aspects starting from

Location
London, a pulsing heart at 180 bpm for 365 days per year, as soon as you reach Victoria Station (I landed in London Gatwick airport) you feel it immediately, you cannot go upstream, you just have to abandon yourself and let the city embrace you with all the vibrant lights, people, traffic, shops and smells, you can try to just focus on one thing at the time but the amount of stimulation you get is so massive that is almost impossible to dissect every single aspect, you simply can’t, your brain is overflowed!
The conference is hosted in the Business Design Center, a very big place but not huge, I decided to reach it by walk from Victoria station (about 5 miles) cause the route allowed me to appreciate more slowly London 🙂
The BDC as far has I seen isn’t just used to host only conferences but is also a permanent place for some offices/shops/studio/whatever, for the Droidcon there was 5 rooms (gates) with decreasing space starting from the biggest one, the G1.


The main entrance area outside has been used as a space for registration, expositors, sponsors, food area, drone area (yes you read it right) and my favourite one… ping pong tables!

Talks
The Droidcon span over 2 days (for the talks), every day has an opening keynote and a closing keynote aimed to every developer and between them you can choose whatever talk you feel more interesting, stimulating 😉
Here the talks I chose to attend:

day 1

Overall all the talks were interesting, clearly some of them impress me more but the quality was pretty high, congrats to all the speakers!!

Honourable mention
Please take 20 mins of your time to watch out the The Baddest Android Advice talk, believe me it worth it from any point of view 🙂

The first day closed officially with a party, that means music, beer and drinks, was a nice moment for talk and relax with others developers and play ping pong 🙂
A side note for the organiser (if anyone is ever going to read these lines) please bring more food!!! Developers are always hungry by definition … I’ve seen storm of people attacking anything edible 🙂

day two

Second day was pretty similar to the first one, lot of interesting talks and one in particular was so amazing, I hoped Google releases a new uber language for general purpose, something that could improve every aspect in our life, and yes Chet Haase and Romain Guy presented F.A.R.T. , please watch out the video and prepare yourself for the language of the future!

Honourable mention
The closing keynote was held by Jack Warthon a guy that doesn’t need to be presented cause he infests our .gradle library section 😉
The talk entitled “Sinking your teeth into bytecode” was not properly a light session, particularly after a 2 days non-stop, nonetheless was very interesting cause emphasise the fact that it’s always a good thing to dig a bit and find out what’s happen under the hood after the compiler generate the bytecode, I highly recommend you to take a look.

Overall organisation
Organise a congress like this it’s not an easy task, I really appreciate the work that the guys from skills matter have done, my only concern is that there was no official app for this congress and it’s a bummer cause as a developer and as user I take for granted an app for the most important android conference in EU.
An app could ease checking in which room the talk is going to be (room number changed dynamically accordingly to the interest expressed from the participants the day before) also could simplify the evaluation of a talk (why use a different coloured post-it right just outside the room)  and much more …
That said I’m sure next year will be an even better conference and some aspects will be refined and improved, I’m so sure about it that I’ve bought the ticket for the Droidcon 2018 the day after!

Final considerations
Droidcon in London is not cheap, hotels are expensive, the ticket for the conference is expensive (when is full price), the food and the travel for reach London are probably the cheapest things you’re going to have if you decide to attend.
All the videos are uploaded online one or two days after the end of the event so probably you’re wandering why spend a non indifferent amount of money for this … good question.
First of all if you plan in advance everything, all the expenses are going to be much more reasonable (e.g. the super early ticket cost 95 pounds) but I think, and I’m sure I’m not the first one writing down this, the thing you can get from any android conference and in particular from this one, is the possibility to get in touch with some of the best android developer out there, talk with them, ask questions, make relationship, find new friends, get in touch with some cool and big companies searching for developers, learn during the workshop (that I miss for another reason) and much more… all the things that a physical human relationships can give you but a virtual one cannot.
You have to establish how much this kind of thing worth, for me is priceless.
Hope this brief description could be helpful to any android developer that for a reason or another hasn’t ever participate to any Android conference around the world, in particular to this one in London, if you have questions please let me know in the meantime I hope to see you next year at the Droidcon UK 2018!

My blog is dead, long live my blog!

Ok, let’s be honest, if I take a look at the last time a post something on my blog a kind of strange mixture of feelings arise in me. At the beginning I started with the crazy ambition to write every week, just after my first post in my mind, I start to say “ok maybe not every week, let’s do it every month” … ah foolish!
I wrote only two posts, one in 2015 and one in 2016 … so yes one per year, I think is a new record in the blogsphere.
I can try to find any excuse for it, but the truth is that I had simply been afraid to write down something too stupid, or not useful at all… on top of this in the evening I’m sooooo tired, the last thing I want to do is write and on the weekend I usually train a lot (triathlon curse), try to clean my little home and if possible try to recover for the next week …. so yeah, you get the picture 😉
Two days ago was talking with a colleague of mine that he also has a blog, and he simply told me

Writing articles is easy if you are writing because you want to share something. It’s really hard if you are just writing an article because you need content.

You know what? He’s right!
Too many times I thought to prepare a cool article on android programming stuff, but too often I failed miserably cause I started from the wrong assumption that I should fill my blog with specific content.
I should fill my blog with things that I want to share, period!
My blog is dead, long live my blog!

isUserAGoat()

From Lollipop was introduced the concept of Device Owner, a sort of super-user with high privileges (not like the system root btw).
As Device Owner you can use methods in the DevicePolicyManager class to take fine-grain control of the configuration, security, and apps on managed devices.
Among the various methods you can find

addUserRestriction(ComponentName admin, String key)

that allow you to set some very interesting restrictions to your app user, for example:

- DISALLOW_ADD_USER: Specifies if a user is disallowed from adding new users and profiles
- DISALLOW_INSTALL_APPS: Specifies if a user is disallowed from installing applications.
- DISALLOW_FACTORY_RESET: Specifies if a user is disallowed from factory resetting from Settings.

… and many more…
If you wanna try I’ve assembled a very simple app-example with all the User Restrictions actually available, you can find it on my github page 🙂

Screen Shot 2016-01-31 at 17.58.06
Moreover there is a restriction kinda strange on the documentation:

- DISALLOW_FUN: Specifies if the user is not allowed to have fun.

Now this mean that someway someone has defined what is “fun” on the device!!
I’m really curious about that, need to try in next days on a device with Marshmallow installed 😉
Oh right, about the post title, UserManager class give you another beautiful method:

boolean isUserAGoat()

Used to determine whether the user making this call is subject to teleportations.
Android Os … so so powerful!

ps: If you want to try the code you need to assign Device Owner privileges to the apps, for doing this you need to be sure that on the device (or simulator) there is no google account active, open a terminal and digit

adb shell

then for assigning the device owner privileges type:

dpm set-device-owner it.paolomoschini.usermanagerrestrictions/it.paolomoschini.usermanagerrestrictions.receiver.MyDeviceAdminReceiver

Trying Vuforia with Android Studio

So you have heard of Augmented Reality (AR) and all the coolness you can do with it, you wanna try right?
There are a lot of AR engines out there but one of the best you can put the “dirty” hands on is Qualcomm Vuforia.
First of all you need to create an account on the developer page, after that you can login and go to the “Download” section.

20151117_img0
As you can see the SDK is available for Android, iOS and Unity, please notice also on the submenu items “Samples” and “Tools” we’re going to use them a bit later.
Proceed to download the SDK for Android (at the time of writing is avaible the version 5), unzip the content and take a look inside, the “build” folder is the interesting one,
infact it contains the library Vuforia.jar and the compiled engine libVuforia.so
You have seen the “Sample” directory right but it’s empty, so what?
As the readme.txt reports you need to download the examples from https://developer.vuforia.com/resources/sample-apps but the links is broken … the correct one is https://developer.vuforia.com/downloads/samples
From the above page you need to download, in the “Core Features” section, the Vuforia Sample Core for Android, check the page there are a lot of material here: Digital Eyewear examples (Google Carboard rules!), Advanced Topics, Best Practice and Vuforia Web Services.
Unzip Vuforia Samples, we’ll use the extracted folder as base for our test, open Android Studio and choose “Import project”, select the Vuforia Samples folder, set an Import Destination Directory, keeps all the import options, you have to set Vuforia.jar path edit the field with the location of Vuforia.jar contained in the SDK previously downloaded (Ex /Users/paolo/Downloads/vuforia-sdk-android-5-0-5/build/java/vuforia), click on Finish.
Android Studio should have imported the project, but there are a lot of errors related to unknow classes (Vuforia classes!), these because Vuforia.jar is not in the correct location.

20151117_img6
You need to create a “libs” folder in “app” folder of your project and move Vuforia.jar file from the /your_project_path/VuforiaSampleProject/app/src/main/java/Vuforia.jar to “libs” folder.
Now you need to modify your module build.gradle (not the project one!) file, add these lines at the end:

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

Sync the project with gradle, voilà errors are gone!

Build and run the project on your device, you should see something like this

20151117_img1

Try selecting Image Targets … arghhh nothing happens, we have to do 2 more things 😉
Project needs also libVuforia.so, an easy way to import this file in your project is create a zip from the “lib” folder from the Vuforia SDK folder:
20151117_img2
now move lib.zip in the “libs” folder of your project (the one that contains Vuforia.jar), rename lib.zip in lib.jar, recompile and run the project, select Image Targets:
20151117_img3
Ok told you, one last effort, the vuforia App key!

Open Vuforia developer portal page, go in Develop section, and click on Add License Key button, choose a name for the license (Ex. VuforiaSamples), select “Mobile” Device and “Starter – No Charge” License Key, confirm the data, you will receive an email related to Vuforia Application License Key.
Good! Select and copy the license created
20151117_img4
We need to paste the vuforia license in our example code, select SampleApplicationSession.java, find the inner class InitVuforiaTask, inside the method Vuforia.setInitParameters(Activity activity, int flags, String licenseKey) paste your code.

20151117_img7
Recompile & run your project, try for the last time and … fingers crossed, it works!
Ok, we need a marker (an image that is recognized from this sample, for the Image Targets we need Stones, Chips or Tarmac), all these images and others are in “media” folder inside the “Vuforia Samples“.
20151117_img5
Cool! 🙂

Final considerations
Try all the Vuforia samples, move on the advanced ones, you will find a lot to learn and to play with 🙂

Happy coding!

p.s. I’ve uploaded in my github page a Vuforia Samples project for Android studio for testing. Please remember to add the Vuforia license code 😉

0

public static void main(String[] args) {
    System.out.println("Hello World!");
}