Showing posts with label Android App Development for beginners. Show all posts
Showing posts with label Android App Development for beginners. Show all posts

Wednesday, 12 October 2011

Rooting my Galaxy S2

Since Samsung haven't yet released the official Android 2.3.4 upgrade, I'm going to have to use an unofficial version, which means rooting my phone and changing the ROM. Luckily, rooting is pretty straight-forward (although it does invalidate my warranty!).

It only takes about 15 minutes in total, but I have to admit it's pretty nerve-wracking. I've bricked phones in the past, but none I've ever been particularly bothered about. Fortunately, this guide is excellent, and I had no problems at all.

So now I'm in possession of a rooted handset, my next step is finding and installing an unofficial upgrade.

Tuesday, 11 October 2011

First Apps - Accelerometer

Once happy with the compass, I started on the accelerometer app. The idea is to display the data received from the accelerometers textually and graphically.


I tried this using both the SensorManager.getOrientation() and the Sensor.TYPE_ACCELEROMETER methods. I found the latter worked better, as the former jumped from 180 to 0 degrees, which would cause problems later on. The code for this app is available here.

First Apps - Compass

The idea is to build my final app up from individual modules, starting with a Compass app, an accelerometer app, and location apps. The first few are pretty much completed.





The above screenshots show the compass app. The arrow is rotated according to data received from the handset's magnetometer, and always points North. I used the getRotation() method from the Display class to adjust for different orientations. This means that when the handset is held in landscape mode (as I anticipate it will for most uses) the compass 'face' points out from the back of the phone, rather than the top where the magnetometer is actually situated.

The code is available here.

I have noticed how easily the compass is affected by outside sources, the magnet on its case causes particular problems. The compass is easily recalibrated by moving it in a figure of 8 shape in the air however.

Thursday, 22 September 2011

Tutorials. Hundreds of tutorials....

Haven't posted anything for a while, because I've been busy working through a load of The New Boston's youtube tutorials, which cover Java, XML, SQL, openGL and are an excellent source of information on developing Android apps. I've also worked through a book called Learning Android by Marko Gargenta. It's not quite as thorough as the youtube tutorials, but it's still a useful source of information.


I've now got a pretty good idea of what tools I'll need to use to build the app I have in mind, so I'm going to spend some more time getting the hang of them, (particularly OpenGL) before I start putting the app together. I know the app is going to make use of the following hardware;



  • Accelerometer
  • GPS reciever
  • Magnetometer (Solid State Compass)
  • Camera

So I'll also be learning how best to integrate these into my app. Back to youtube then...

Monday, 4 July 2011

Using Eclipse

After taking a week or so off, (spent wading through mud at Glastonbury) I have started trying to get to grips with using Eclipse, following the developer's guide provided by Android.com.


This is much, much more complicated than using app inventor, and since I have no experience of Java (and only limited amounts of C++), it looks like I'll be spending much of my spare time this summer learning to code. Good times!

Monday, 20 June 2011

Touch to Talk - a simple communication aid

The first app I made from scratch using app inventor was touch to talk; a basic soundboard which would allow a child with speech problems to communicate simple phrases, such as the desire for something to eat or drink.


Four global variables were created, and linked to the 4 button groups on the screen. This meant that if a mistake was made, it could be rectified by simply choosing a different button in the same button group. It also meant that the selections would be read out in a predefined order, regardless of what order they were entered. Upon hitting the 'Speak' button, the variables were read out by the TextToSpeech component from the 'Other Stuff' palette.


Not all of the app is shown on the emulator, as the screen is smaller than that of my phone, and as I mentioned in the previous post, I have been designing the apps using my phone for testing. Later on, I will hopefully learn to create apps that automatically adjust to the native screen size.




Bobo Smack - A simple game

After making the molemash tutorial app, I added a few features to it. Instead of a mole moving around the screen, I had a picture of my girlfriend, and had her record sounds which play at random when a point is scored (although not every time a point is scored, as this quickly became irritating!). I also created levels, so that the speed at which the sprite moved around increased with every ten points scored. Finally, I included a hits to misses ratio, which rated the players accuracy.


A screenshot of the app running on the App Inventor emulator is shown below. I found that connecting the blocks editor to my phone, and testing apps on that was preferrable, and only used the emulator to take screenshots.


Starting out with App Inventor

As an Electronic Engineering student due to start my final year in October this year, I have decided that my final year project will involve developing an app for Android (I have already got a particular program in mind, but will elaborate on that later). My supervisor has suggested that I maintain a blog of my experiences, as it will hopefully serve as a useful reminder of what I have done, and may be useful to future students.


I have purchased a Samsung Galaxy S2, since it comes with the features (accelerometer, magnetometer, GPS) required for the final app I intend to make. The first step so far has been to play around with Google's App Inventor service, and complete the provided tutorials.


App Inventor is designed for complete beginners, and requires no previous programming experience (I have a little C++ knowledge, but having carried out some research it seems that Java is the preferred language for Android, and Eclipse the most highly recommended IDE). It is a good way to get a general feel for how an app comes together, but its abilities are limited, and apps built using App Inventor can not be uploaded to the Android marketplace.


Having completed most of the tutorials, and built a few basic apps of my own (see later posts for details), the next step will be to install Eclipse, download the Android SDK, and start to code apps using Java.