Monthly Archives: February 2014

You are here: Home . Archive

[Android dev tutorial] Setting up an App-Engine Connected app. The Hiccups

If you are one who wants your android app to scale massively without worrying about loosing sleep over database & server issues (and a host of other ailments that come from staying up too late worrying), hooking it app with an App engine backend is a smart thing to do. It let’s you focus on code.

You as developer, server admin and Db admin

You as developer, server admin and Db admin

Google has two great tutorials (here and here) on how to get the full monty up and running. The aim here is to fill in the bits they left unspoken and hopefully save you the hours of hair-pulling a friend of mine had to go through. By “friend” I’m not referring to myself-true story.

1. For your first run, use an emulator. In the tutorials it might seem like a suggestion but going down the setting-it-up-on-your-handset rabbit hole isn’t very pretty. It isn’t helped by the fact that you are still trying to wrap your head around a few new concepts.

2. If you are feeling like a ninja and you insist on running the app on a handset, kudos to you. You very likely will have to change this:

LOCAL_APP_ENGINE_SERVER_URL_FOR_ANDROID = "http://10.0.2.2:8888";

This is in CloudEndpointsUtils.java

Why?

When running on an emulator, that line tells the emulator that the server is located at 10.0.2.2. That basically maps back to your localhost. Details here: http://developer.android.com/tools/devices/emulator.html#networkaddresses

So, if you are running your tests off a handset, whatever address you put there should map back to your localhost from your handset. This means the two [handset and localhost] should be on the same network. Wifi, LAN, whatever. Your server should also be set-up to accept connections from any host [and not only localhost, which is the default setting] To make things easier on yourself, if you must use your handset, set

 protected static final boolean LOCAL_ANDROID_RUN = false;

This way, you are running off the remote app engine app instance. When you get comfortable, go get your PC and handset to talk.

Power Tip: To allow your localhost to receive connections from anywhere,in Eclipse: select the server project -> right click -> Run as -> Run Configurations. Select the Arguments pane and in Program Arguments, add --address=0.0.0.0 in front of the --port=8888.

3. 404 Error

The version your local code knows about should be the default version in the cloud. You might get the following error:

</p> <p style="text-align: justify;">02-08 18:34:59.990: E/com.kanzucode.android.test.GCMIntentService(27575): Exception received when attempting to register with server at https://test-app.appspot.com/_ah/api/ 02-08 18:34:59.990: E/com.kanzucode.android.test.GCMIntentService(27575): com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found 02-08 18:34:59.990: E/com.kanzucode.android.test.GCMIntentService(27575): Not Found 02-08 18:34:59.990: E/com.kanzucode.android.test.GCMIntentService(27575): at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnErr or(AbstractGoogleJsonClientRequest.java:113) 02-08 18:34:59.990: E/com.kanzucode.android.test.GCMIntentService(27575): at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnErr or(AbstractGoogleJsonClientRequest.java:40)

Don’t sweat it. Go here https://appengine.google.com/deployment?app_id=s~your-project-id and make the version you’ve uploaded to be the default version

Why? Your app goes to app engine looking for http://1-dot-your-project-id.appspot.com (where 1 is the deployment version) but it doesn’t exist because your app is at http://current-default-version-your-project-id.appspot.com..hence the 404 eror

4. Generating Cloud Entity Backend not working/Build Path Source folders missing In Eclipse, this happens if the generated source files are not correctly added to your build path. To correct this, go to your client app > endpoint-libs>lib{classname}-v{versionNumber}>{classname}>{classname}-v{versionNumber}generatedsource Right click that folder, select Build Path and choose ‘Use as source folder’

 

eclipse_google_app_engine_plugin_add_to_source

Figure 1: Navigate to the highlighted item (or the equivalent for your Cool. Received. You are welcome select Build Path and choose ‘Use as source folder’

Have you run into something different? Have you run into one of these and resolved it differently? Do share

7 steps to iPads mastery

Not so long ago, in a land where the sun never sets and money grows on trees that there is so much and the powers that be choose to send some abroad to buy expensive gadgets for people who do not use them. Here, the average man’s major problem is whether his MP is reading the latest proposed Bill off paper or on an iPad. We got wind on the need to have more information on how to use an iPad. These tips come when MPs seem to be struggling to use the device but it is merely coincidental and these tips aren’t targeted at them at all.

1.Switch it on
You will know it is on when it glows – not the glow of a torch, more like the quiet, unassuming one of a low Watt bulb.
2.Swipe with your finger
No buttons. I know, deplorable. You need to move your finger across the screen to do anything. Pressing buttons on your phone after spending so much time at a PC keyboard causes immense stress. The swipe motion addresses this. Imagine you are a conductor (of a choir, not a taxi) – the hand movements you would use there are similar to the ones you need here

3.Download and install
Get Whatsapp – it is this thing that allows you to send SMS using the Internet. The other person sends you a reply SMS instantly. If they do not, you can see when they were last online so you know that they are merely ignoring you. The golden “don’t drink and sms” rule applies to Whatsapp too.
4.Like your phone, do not wash it.

life006px

5.Some iPads take SIM cards, others don’t. The latter are meant to only communicate using Wi-Fi. In a country like ours, using an all Wi-Fi device might present a few challenges since coverage is limited. There are workarounds though, like spending all your days at Javas

6. If it is well wiped, you can use it as a mirror.
7.Show it off, we need to see it
Use every opportunity to whip it out; it is so big that having it lying idly in your hand only wears your body down fast. Read your speech from it. Toast by asking fellow MPs to raise their iPads (not their glasses). When making a point, whip it out to show off an image to bring the point home.

A case for iPads

I know, I’m late to the bashing-MPs-for-getting-iPads party. Now that I’m here, where are the drinks? I’d like a seat too. All the bashing out of the way, do you know why your MP needs an iPad? Read on.

Better dress sense
The glossy images our beloved leaders are going to be exposed to with these devices will no doubt edge them out of some ill-fitting suits.

Improved attendance
Before plenary sessions, our selfless leaders will charge them at home then come to Parliament to make good use of the Yaka Units invested.

Death to poor English
Bad English will go out of the door. One cannot be exposed to all that text on the internet and not be hugely impacted. Big words will become commonplace in the corridors of power.

Immense patriotism
The internet is awash with images of posh countries and the things they are doing to get better. These images will bring tears to the eyes of our leaders and they will rush back to Parliament to stay awake and contribute powerful ideas.

Knowledge
They will read more. Talk in the corridors won’t be about custody battles for children but GDP, GNP and all those abbreviations that powerful people use.

Electricity
iPads need juice; charging them (seeing as MPs will use theirs A LOT, they will charge them much more than your average Kasibante Kalyesubula). This translates into more revenue for our nation.

Pressure groups
Our beloved leaders will take pictures of potholes and display them while agitating for an allowance for a car. Better cars on the road and no potholes – double win!

Selfies
A selfie is a photo taken of yourself by yourself. With iPads, our leaders can take several selfies. These have several uses; for one, if a leader gets arrested, there’s no need for mugshots. The police will use the selfies

Whatsapp
MPs can get and install this. Their constituents, can monitor their ‘last seen online’ time and know who is working and who isn’t.
Obviously, it is a sign of development.

Uganda : Looking for love

It is the month of love. A month to have giddy feelings in your chest. That time of the year to walk on sunshine. The season where your heart pumps faster. That time when red and black paint the town. It is also my worst time of year. I’m alone you see and there’s no better reminder of this than this season.

Hi, my name is Uganda and I’m single and looking for love. It hasn’t always been this way; I’ve had a number of suitors but it has always ended in heartbreak. Hold on, don’t jump to conclusions yet. It isn’t me, it’s them. I’m hot you see. Literally and metaphorically. I’ll let those big words linger-see, my English isn’t the problem either. I’ve been called a pearl before. I have quite a bit of talent. I’m polite and hospitable. I have lots of resources. I just don’t get it.

Strange thing is, it always starts out nicely-the stuff fairy tales are made of. The suitor shows up with a pen or gun and I’m handed over to him. At this point my guard is usually up-I know his kind and I have no time for games. He however, wastes no time and promises me everything. He doesn’t put his best foot forward, he literally hurls his best side forward and does a creative dance for effect. A few radical moves later, I’m sold. My heart skips. This is it. This really is it! I know I should know better but hope and I are joined at the hip.

I’m now a bit older. And wiser, I guess. I know I’m not quite the prize chicken I once was (stories about me back then used only superlatives. Today, not so much) but hope hasn’t completely left. She’s shriveled now from being beat down so often but she’s still there. Bruised, unwilling to lift her head but still there.

So this is me, turning to the classifieds. I know how low this is but at the rate things are going, I’m not sure I can leave things to chance anymore. I’m turning to my children; love needed.  My garden could do with some tending. I could do with a trip to the salon or a few words of encouragement even.  Show me some love.

Graduation speech for future presidents

This time of year, your oratory skills are put to test. Graduation ceremonies are the source of many sleepless nights in your neighborhood. You aren’t bothered though because yours is one of them. You’ve dreaded the day you’d have to stand before several people and say more than your name from the time you tried to seek votes in secondary school.

When the time came to stand on the tree stump that served as a podium, your ever-present brain chose to go see what the chief cook was preparing for lunch. Don’t worry though, here’s a graduation speech for you.
Thank God. It hasn’t been an easy ride but you scraped through to the Promised Land. All those ayiyiyiyis from your relatives from outside districts are for you

Thank the engineers at Microsoft for the amazing copy – paste function they brilliantly conceived so many years ago. Without it, you wouldn’t be standing before us, your eyes watery, your throat dry and your legs wobbly.
Thank Jemimah who always reminded you the night before course work was due so you could put that copy-paste function to good use. Thank Timothy, who let you sit next to him during exams and tests.

Thank the different social establishments around the city for allowing you to frequent them. They might be the reason you needed Timothy’s help but they helped you maintain your ‘cool’ label which you are going to use to get you a job. Thank Thomas too. His faithful vehicle wasn’t initially created to carry 13 people but it faithfully buckled up and carried you and your crew to said establishments every other weekend.

Thank Mama Dorcus for providing culinary delights every day. She stepped in where Hall lunch failed.
Thank Jimmy, down at the photocopier. He enabled you to read notes written in a crisp handwriting; you didn’t have to suffer through your own notes-the ones written like you were fighting

Thank Sam for all the latest movies and series he braved the computer lab cold to download. Without him, you’d have had to go to EddieSoft. You’d also not have been able to participate so excitedly in all those conversations about series

Thank your parents and or guardians. Thank your other friends.
Tell us you are now ready to take on the world. Tell us how you know there’s work to be done in our country and you are ready to brave it out. For God and your country