About Uncle Code Monkey

Proud Monkey's Uncle who fancies himself a code composer that is hard at work building Androids for Google's army.

Pick Folder Intent

One of the powerful features about Android vs other mobile operating systems is the ability to create and Intent and ask the system if there are other activities that might be able to respond, even if they are in some other app. Why reinvent the wheel with every app if there is already one much more capable already out there? By apps working together, we can create an ecosystem of apps that inter-operate without requiring explicit code shared between them. Intents are powerful in that they are open ended and can carry a vast array of data and filters between apps. However, since there is no strict definition on how to create intents for all kinds of purposes, one must follow published guidelines from the authors of apps or rely on a site like OpenIntents.org that register Intents so others may use them correctly. Continue reading

FileBrowser Send / Receive Intents

Blackmoon File Browser app has grown from a simple browser to a full fledged file manager and able to launch apps based on the given file name so that you don’t have to launch the app and then open the file. Expanding on this idea, FileBrowser grew arms with which to pass off data to other apps in singles or multiples. FileBrowser then grew ears to listen for other apps that wish to use it’s functionality to pick files or folders. Most of these Intents are discoverable, but any good dev knows that getting information directly from the source trumps whatever else is available. In this article, I will specify what Intents FileBrowser uses and how you can use them in your own app. Continue reading

Android: Always create a Launcher activity!

ALWAYS CREATE A LAUNCHER ACTIVITY!

I cannot stress that enough. When I created AttachSave, I designed it with the intention that it would be a small, hidden app that did not clutter up the launcher tray with useless apps that couldn’t be run traditionally anyway. Despite warnings from others posted elsewhere, I thought making the description quite clear on how to use the app would be sufficient to teach people on how to use the app. Continue reading

Revisiting an old injury I did not miss

Since Monday, I’ve been living with an old injury that has resurfaced – Rotator cuff tendinitis.  During my last ordeal, the doctors were amazed that someone so young had it, that my background did not fit their risk profiles, and that my particular case also had a rare twist with it.  The injury, they explained, was the result of too much stress on the shoulder muscles to the point where they become inflamed and rub against each other.  The rubbing causes the pain.  There can also be some tearing, which causes scar tissue to form and that scar tissue will rub against the other muscles and also cause pain.

I had to attend a class on this injury to learn more about it and what were my options regarding treatment.  I was the youngest one present by a span of decades.  I learned that the injury “almost always” occurs in relation to your occupation or if you are a certain kind of athlete that needs to routinely raise their arms in the air (think tennis player, traffic cop, hairdresser).  Those kinds of professions and activities over a lifetime can lead to rotator cuff tendinitis.  None of these kinds of activities describes what I do or even anything I regularly perform, let alone having done them over a lifetime.  I also have a twist upon the normal tendinitis in that my muscle scar tissue calcifies… becomes tiny bits of bone.  I was told it was like having very rough sandpaper sprinkled throughout the muscle and it causes severe pain whenever the muscles flex.

There are two basic treatments for this kind of injury – surgery or rest.  Surgery came with a 50/50 risk vs. reward, with the risk being that increased damage to the shoulder is just as likely as not and that any damage incurred during surgery is likely permanent.  Just getting rest is both long (6 months is common) and complicated by the fact that relaxing the shoulder is damn near impossible.  You see, the shoulder is a ball and socket joint with muscles all around it.  It is one of the few joints the body has which allows extreme movement in any direction.  This means that no matter what position you are in (sitting, standing, lying down, etc.) at least one of the muscles in the shoulder is flexing just to counteract the weight of the arm against gravity to keep the ball joint centered within the socket.  This also means that at least a few of the muscles are constantly being flexed and cause pain.

I do not wish to choose surgery, I do not want to risk further injury.  I have lived with it before, in 2006, and fully recovered, so I plan to do so again.  The pain was much worse then and I took nearly 10 months to fully recover.  It was during that time that I learned to play WoW with one hand.  I eventually got to a point where I could prop my right arm such that I could use the mouse, but it was still limiting with having to type with one hand.  This time, while still quite painful, I already know the symptoms and the treatment process and have taken steps already to minimize the effects, but they are still present.  I hardly sleep more than 4 hours since that’s how long it takes for the ibuprofen to wear off and the pain to come back in force.  I cannot use my right arm for just about anything and merely holding my cell phone is enough to cause pain – lifting my arm is impossible at this stage.  I am able to prop my arm up so that I can play WoW and use a mouse, but typing is severely hampered by having to use just one hand.  I’ve recently managed to use my left arm to lift my right arm from the mouse and place it on the keyboard in order to type, but by doing so, it also means a brief pause when I finish typing to move my arm back over to the mouse.  Such back and forth movements during combat are prohibitive, which forces me to be quiet or have slow reactions to written communication.  If my dwelling had thicker walls, I could use a microphone without disturbing anyone, but unfortunately, that is not the case.

Getting dressed using just one arm, brushing teeth with my offhand, complications using a computer… I’ve gone through this all before and it lasted many months.  I am hoping that I’ve learned enough during my previous experience that I am able to adapt quicker and hopefully recover in a much shorter time than before.  This time I do not have to retrain my body to not sleep on my injured arm, which is what I had to do last time.  You don’t realize how hard it is to train your body to perform, or not to perform, certain actions while you are asleep, but it can be done. I used to require placing my head upon my right arm as I went to sleep each night.  Once that became impossibly painful, I had to retrain myself to avoid doing so, usually waking up many times a night wracked in pain from having rolled over and back onto my arm.  Sleeping is still painful though since nothing is ever comfortable or relaxing for my injured shoulder.  Thankfully, Advil works to lessen the pain enough most times so that I get some form of sleep until it wears off and I need another dose.

Apologies in advance to those who group with me in WoW.  Playing can be painful at times, but I hope it has little impact on my reaction speed… though it definitely has an impact on my communication responsiveness.

Android: Postmortem Reports via email

How can I get postmortem exception information from my deployed app without requiring net access?

One of the major breakthroughs I have had with my Android development has been the addition of a postmortem exception reporter into my apps. I started out my development on the emulator only as I did not have an Android phone of my own yet. I ran into the dilemma of having code that worked fine on the emulator, but crashed on some phones out in the field. Comments were pouring into my app with 1 star ratings and “FC on open”. I searched far and wide for a solution to use with postmortem crash analysis, but each one I researched required net access on the phone in order to report back. I was not going to force the requirement onto my fans because I don’t trust apps that should not need net access but do, so why should I force my fans to trust me? Continue reading

What is a “gopher” app?

Aside from the usual reference to a certain networking protocol, I made up the term to describe a certain kind of application.  While the implied phrase of “go for …” has some meaning for these small apps, it also shares other characteristics of the little animal.  A gopher app has little, if any, user interface.  Most of it’s work is done underground, hidden from view, and only occasionally pops its little head up now and then when it requires some user interaction.  These kinds of apps do not exist as a Widget on your phone’s Home screen, do not reside in the App Launcher area like a traditional app, are small and prefer to stay out of sight (or underground) until you need them for their specific task.  They are not libraries that sit like a book on a shelf waiting for someone to come use them, nor are they like a nasty virus who try to stay completely out of sight for fear of cleansing.  They can be managed like a normal app so that if you find it annoying, you can hunt it down and kill it (by uninstalling the thing), but for the most part, they stay hidden and only pop up when you need them.

The primary example of what I am talking about is my AttachSave app. The whole design is to extend the functionality of another app and not really do much on it’s own.

Android: Using Blackmoon File Browser’s MIME type provider

The function I use to translate a filename and given extension into it’s MIME type is available as a Provider in BmFB so that you can use my work for your app too.

    Uri theContentProvider = Uri.parse("content://com.blackmoonit.android.mimetypeprovider/getMIMEtype");
    Uri theContentTypeRequest = Uri.withAppendedPath(theContentProvider, aFile.getName());
    Cursor theTypeResult = managedQuery(theContentTypeRequest, null, null, null, null);
    theTypeResult.moveToFirst();
    if (!theTypeResult.isNull(0)) {
        String theMIMEType = theTypeResult.getString(0);
        ...
    }

The Value of Freedom

America’s freedom may be purchased through her military strength, but how many realize that it is just as important for everyone, not just those in her military, to be ever vigilant about retaining those freedoms?  How many can look at any proposed law change and see such a change as bolstering or eroding our freedoms? I guess one way is to learn from someone else’s successes and failures. A friend emailed me a part of an eyewitness account of what occurred in Austria around the time of WWII.  I found it quite thought provoking since it was not a “what if” – rather it was “this happened”.  Instead of reprinting it here, I will just supply a link for those interested in a little bit of history as told by someone who lived through it:  America Truly is the Greatest Country in the World. Don’t Let Freedom Slip Away.

Truth is Stranger than Fiction – Episode 2

Driving along the east coast in October, I came across a strange sight.  I found myself northbound on U.S. Highway 9 taking the scenic route (and avoiding the toll roads) along the coast.  The highway meanders up through small towns, colorful autumn forests and crossing river outlets to the ocean.  Rounding a bend in the road 7 miles south of Tuckerton, NJ and just south of the New Gretna Post Office, in field to the west side of the road at mile point 55.8, I came upon a strange sight.

Wine Bottle Statue

A 20 foot tall concrete wine bottle statue.  Off the side of the road in a small field between two houses.  No historic marker around, no signage, no liquor store nearby, no winery nearby, nothing that would indicate a reason for such a monument.  And yet, there it was – larger than life.  After some searching on the net, I found a link that seems to shed some light onto this strange subject. Apparently, this is an old promotional statue for south Jersey’s Renault Winery and now sits abandoned.