Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Tuesday, 11 March 2014

GitHub Education Discount - Free Stuff!

Github.com is a very powerful and useful tool. For those of you who don't know what GitHub is, it is a version control system. Version control allows you to keep your source code safe and incrementally test, publish and share code.  A free account is available but all the repositories are public. Eclipse and Visual Studio plugins are available. A micro subscription allows for 5 private repositories in addition to the public ones.




GitHub micro is usually $7/month but you can request an education discount. If you have setup an account previously with GitHub login and go to account settings emails and add the email address of your educational institution and click verify. You will need access to the email account to verify the email address.
While still logged in go to education.github.com and click request a discount. Enter you name, choose your verified educational institution email, Institution name, year of graduation and a brief outline of how you intend to use it. Github, upon qualification, will usually give you the micro plan free until graduation.
If you haven't set up GitHub what are you waiting for.




Simples!

Adding Google Play SDK in Eclipse

To develop an app using the Google Play Services API, you must download the Google Play services SDK using the SDK manager. I am making an assumption here that you have Eclipse installed and the Android Development Toolkit (ADT), if you don't stop reading and do so. Note that this article is for Android 2.3 or higher, if your developing for Froyo just stop!



Install the Google Play services SDK:

  1. Launch the SDK Manager in Eclipse select Window > Android SDK Manager.
  2. Scroll to the bottom of the package list, expand Extras, select Google Play services, and tick it. The Google Play services SDK is then saved in your Android SDK environment in <path_to_sdk/extras/google/google_play_services/.   
  3. Install a compatible version of the Google APIs platform. If you want to test your app on the emulator, expand the directory for Android 4.2.2 (API 17) or a higher version, select Google APIs, and install it. Then create a new AVD with Google APIs as the platform target.
  4. Make a copy of the Google Play services library project.Copy the library project at <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects.
  5. Import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.

To make the Google Play services APIs available to your app reference the library project you created in step 4 above.
After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the <application> element:

Once your project references the library project, you can begin developing features with the Google Play services APIs like maps.

Google Play Services 4.2 has just been released and now includes support for developing for Chromecast and Google Drive.

Simples.

Monday, 10 February 2014

Android XML formatting in Eclipse


When working with Android in Eclipse XML errors can be easy to commit and hard to spot. Errors in your XML can lead to your code failing to compile and the auto generated files (e.g. R.java) disappearing.
Proper formatting can make it easier to spot errors like unclosed tags etc.
Take the following code as an example:

Multiple attributes on a single line, a mix of self closing and empty tags (line 15) make this code harder then it should be to read. Fortunately Eclipse has built in preferences which can help you.

In Window>Preferences>XML>XML Files> Editor


Ensure the tick is placed on Split multiple attributes each on a new line.
Ensure Insert whitespace before closing empty end-tags is ticked.
Apply and OK.
Source>Format:

Much better, right? But there's more:
Source> Cleanup Document:


Here you can do the above magic. Press OK and the code looks much cleaner and easier to read:



Simples.