Posts

Integrating AdMob into an Android Processing App

Integrating AdMob into an Android Processing App is surprisingly easy, once you know how. Here we show you the steps so you can display ads and monetise your app

The processing forum has some great advice on doing this, but having tried it, we've adapted and improved this a little and listed the steps here

The following steps assumes you already have a Processing sketch working in an Android app created in an IDE like Android Studio or Eclipse, as you will be dealing with non-Processing libraries. If not, you will need to port your sketch over as shown in the really useful tutorial over on processing.org

We also assume you have signed up to AdMob and have an app key for your app. If not, you'll need to have over to AdMob and do so. We recommend using a Smart Banner as this easily adapts to screen size and resolution
Step 1 - Import the AdMob library If you're using Android Studio or a dependency management build tool such as Gradle this is as simple as adding the AdMob dep…

Android Live Wallpaper using Processing in Android Studio

We've recently wanted to create an Android Live Wallpaper using Processing, which is an ideal language for writing these as it makes it easy to create exciting animations using a Java-like language

As it turns out, creating a live wallpaper from some existing Processing code is surprisingly simple

You can, of course, do this using the Processing environment as shown in the tutorial over on processing.org. This covers the basics but we wanted to incorporate this into our Android Studio app which took a few extra steps

Step 1 - Create a Processing sketch in your Android app If you don't already have a Processing sketch, now's the time to write one! If you've written this using the Processing environment, you'll need to create a new class that extends processing.core.PApplet and import the processing-android library, similarly to the processing.org tutorial on creating a processing app in Android Studio

import processing.core.PApplet;

public class YourSketch extends PAp…

How to show Admob ads in an Apache Cordova app on Android

Since the demise of AdWhirl and my previous post about how to set up ads with Cordova, I've had to revisit it and get it working with AdMob which now uses Google Play Services.  Again there are very few instructions around for this, though I did find this useful looking Cordova plugin which seems to offer a neat solution which is likely easier than the solution I'm about to propose and is cross-platform where I am only working with Android.  However, for various reasons, I don't want to use the Cordova tools, I want to do it manually.  If you're like me then here is how to do it

This How-To uses a mash of the Cordova official documentation on WebViews, my previous post on AdWhirl and the Admob Quick Start guide.  The premise here is that, since Cordova can be made to display in an Android WebView, and AdMob also uses WebViews, we can combine the two and display one in front of the other

I'll assume you have an AdMob account and know how to create an Android app in …

Adding Multiple Google Accounts to Kindle Fire

Image
I recently bought a Kindle Fire because they are great value for an Android tablet and I knew they were ways of installing Google Play so I could access the apps I had already purchased through Google Play without having to repurchase them from Amazon. Specifically I wanted Minecraft for my son to play - honestly, for my son ;-)

The Fire I bought was the 5th Gen Kindle Fire (not HD, I wanted inexpensive!) and the awesome instructions on How To Geek worked perfectly at installing Google Play. I highly recommend this solution for installing it, it was simple to follow and easy to do. From here I was able to log in to Google Play and download my apps including Minecraft which I had previously paid for on another device

If all you want from this is to install apps from Google Play using your account, you are all set! However, if, like me, you also want to add a second Google user (in my case, my son) so he can use his account to synchronise his games, I got a bit stuck.  Unlike an Android…

How to manually add Cordova plugins to your app

I have recently been trying to add a plugin to an existing Cordova app (using Cordova 3.7.0).  Since I didn't create my app using the CLI I had 2 options:


Create a new app using the CLI and copy my source files overAdd the plugin files to my existing app

For some reason I don't really like the idea of the CLI and wanted to do do this manually into an existing Android app, using Cordova, rather than use the CLI.  Don't ask me why, I just like doing things manually so I know what's going on under-the-hood I guess

If you are like me and want to add a plugin manually, this is how to do it.  These instructions, though written for Android, will work for any any supported platform.  I will call out any differences between platforms that I know of

Get the plugin source files You need the source code files for your platform (so .java for Android, .m .h for iPhone etc) as well as the plugin javascript files.  You might be able to get the source files from the internet but if not …

Manual upgrade of Apache Cordova for Android (2.9.0 to 3.7.0)

I hadn't upgraded Cordova for ages and was still on version 2.4.0 (now at 3.7.0 at the time of writing). so I was surprised, but mostly dismayed, that I now had to use the Cordova tools to create apps.  Maybe it is just me but I liked being able to copy the jar, javascript file and config into an Android app myself.  I did have a go at using the tool, but the npm still didn't create the jar I wanted and I'd be forever tied into using the tool.  So I spent some time working out how to upgrade manually, and this is how to do it.  

This obviously relies on you having java and android installed, which I'd guess you have if you're upgrading an Android app

Step 1 Download the latest zip file from http://cordova.apache.org/ and unzip it.
Step 2  Install android if necessary and add it to the OS path.  You need ANDROID_HOME set or the android executable on the path.  I added both.

Make sure you have Android version 19 installed from Android's SDK manager
Step 3 Install…

Mobilize.js versus responsive web design (RWD)

Image
Mobilize.js versus responsive web design (RWD) Both mobilize.js and responsive web design offer solutions to having a mobile and desktop site from the same codebase.  This is a comparison and evaluation of the 2 approches

I previously blogged about mobilize.js and how it can be used to transform a website dynamically between a desktop and mobile-enabled site.  As a brief background, mobilize.js is a javascript library that detects if a mobile browser is being used and, using client-side javascript, and re-renders the page using predefined
mobile-optimised css.  However mobilize.js is no longer being developed - the developers now recommend using responsive web design instead.  In one of the comments to my original post I said I would check out the relative merits and report back - this is me reporting back

Responsive web design works by detecting the size of the display and rendering differently using css (css3) media queries.  The screen size can be set in the css (or different css …