Category Archives: Android

Beta Testing on Both Platforms – Android and iOS

Android

1. Upload your APK to the Beta tab of Google Play’s developer console.
2. Create a community in Google Plus, and invite your users.
3. Add the link to the community page to your Beta.
4. Click on “invite testers” and you will receive a link to the app on the play store- but just for testers (it has “testing” in the path).
5. Email your users, and emphasize that they should click this link on their device- obvious but bears pointing out- and give it a few hours.

iOS

1. Upload a release version of your app to the Prerelease tab on iTunesConnect. This requires an almost complete store profile.
2. Submit it for approval (still in pre-release mode, will not be public).
3. Add external testers in the “prerelease” tab of iTunesConnect, for your app.
4. Invite them.
Note: there is potentially more complexity to this that I will detail in another blog post. This is the best case scenario- that has actually worked for me. For internal alpha users, yes, that was buggy as of a month ago.

Both methods are key to getting a good set of beta testers. I used to use TestFlight for both Android and iOS, and those were great days. Both platforms are now more advanced than old TestFlight, with crash reports and better user management. Apple still has some kinks to work out but it worth it for a nice process that doesn’t require device Ids.

Also, checkout the bug I found: using Gmail to check for app invitations results in errors. More: here.

A Simple Android App

I’ve had to clean up a few “first apps” and that led me to wonder- are there any good tutorials out there? This app is probably the most super simple Android app you can make. A button! That does something! But it’s a good starter- it’s bare bones, only what you need to have.

Download full final code here.

This is for SDK version 19 (KitKat). This sample app will have a button, that when clicked, does something. This works, though for any SDK 8 and up.

1. Download the Android SDK from Google.

2. After successfully installed, create a new Android App: File/New/Android Application Project.

3. Give your app a name, such as “ExampleApp”.

4. Set “Theme” to “None.”

5. Click “Next”

project_setting

6. Unclick “Create Activity”

7. Click “Next”

8. Click “Next”

Screen Shot 2014-06-15 at 5.22.34 PM

9. Unclick “Create Activity”

10. Click “Finish”.

last_activity

Why did we uncheck things?
Basically, with version 19, you get a lot of complicated features with a default app- such as fragments and menus- that are best explained after you make a simple app.

Clean Up Project (Remove Unnecessary Files)

Once you click Finish, Eclipse creates an app with relevant directories in your workspace.

1. In Eclipse, open AndroidManifest.xml. In this file, remove the line, under Application, “android:theme=”@style/AppTheme”” Make sure the Application still has an ending bracket, “/>”.

2. In each “values” directory, delete the “styles.xml” files.

3. In lib/ delete the “android-support-v4.jar” file.

4. At this point, go to Project/Build Project. It should build successfully, and you should have no red x’s near any of your directories.

If you do, compare your project to mine up on Github, a bare-bones template for starting an app with no activities or Java classes.

Creating an Activity

1. Right click (or Control-Click for Macs) on the project name in your Package Explorer, and select “New/Class”.

new_class

2. Enter in “MainActivity” (or whatever you want to name your first view). For the Superclass, enter “android.app.Activity” and select “Finished”.

3. In the AndroidManifest.XML file, add an Activity element within the Application. Also, for this Activity, nest an Intent-Filter to launch the activity.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.exampleapp"     
    android:versionCode="1"     
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
       >
       <activity android:name="MainActivity">
           <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
       </activity>
    </application>
</manifest>

4. In MainActivity.java, add the following code: the package (your full app name), the libraries we will use, and we’re inheriting and modifying (later on) the onCreate() method.

package com.example.exampleapp;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
    }
}

Take a moment to Build Project to make sure you haven’t introduced any errors.

5. Now we’ll create the layout- the first user interface element. Select the layout directory in the Project Navigator, and right-click or Control-Click, select New/Android XML File.

6. Name the file “activity_main.xml”. In “Root Element” leave LinearLayout selected. This will create an xml file in your layout directory named “activity_main.xml”.

Save files, build project, to ensure everything is trouble-free. There should be no red x’s next to files.

7. Next, open up MainActivity.java and in the onCreate method, add the direction to load the xml file:
setContentView(R.layout.activity_main);

    @Override
    protected void onCreate(Bundle savedInstanceState){
        setContentView(R.layout.activity_main);
    }

8. Back in the XML file, let’s set the background to red, so we know it’s working properly: in LinearLayout tag, add “android:background=”#cc0000″”:

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout   
        xmlns:android="http://schemas.android.com/apk/res/android"      
        android:layout_width="match_parent"     
        android:layout_height="match_parent"
        android:orientation="vertical" 
        android:background="#cc0000" />

Build, and make sure no errors were introduced.

9. Tether your android device to your computer. Select Project/Run, a window will pop up to select what device, select your android device, and see your app pop up with the correct color you set in the activity_main.xml file.

Adding a Button

1. In “activity_main.xml”, within the LinearLayout tags enter in the Android xml code for a button:

<Button
    android:id="@+id/myButton"
    android:layout_height = "wrap_content"
    android:layout_width = "match_parent"
>

2. Save, build, and run. A button should appear.

3. Let’s add a value for the name of the button. To do that, open values/strings.xml and add <string name="button_title">Press Me</string>

Save and build. Check for errors.

4. In activity_main.xml, for the button property, add, android:text="@string/button_title"

Save, build, and run on your device to see the text appear.

Adding Action to a Button

1. Let’s add some action once you click. In activity_main.xml, add to the button property: android:onClick="wasPressed"

2. In MainActivity.java, let’s add a method called “wasPressed()”:

public void wasPressed(View v){
    Log.d("myexampleapp","Button was pressed.");
}

This will log “Button was pressed” to “LogCat” at the bottom of Eclipse, there is a little running Android robot icon, click that and view the Logs. Create a filter by clicking “+” in the left hand panel, and add for the tag, “myexampleap”. That will filter out the many messages to just the ones spawned by your app, and the ones you’ve coded with Log.d (d for debug).

Save and build, open Logcat and select your filter. Run the app. Click the button. You should see the message “Button was pressed,” each time you click it.

Troubleshooting
If tethering your device doesn’t work, go to settings/developer mode and make sure USB debugging is set to on.

If you errors that you can’t clear: go to Project/Clean. Uncheck “build automatically.” Select your project, clean, and then build again. Back step through the steps to and verify each way. Usually it’s XML errors, so keep an eye out.

Setting up Your Android Dev Environment Fast (Mac OSX)

file8241249923891

Ever wondered how to make a mobile app for Android?  Maybe you are looking to make your first app or maybe you’ve made apps before and are looking to start developing for Android.  For me being a mobile app designer, I needed a way to see what was happening under the hood of in-progress apps.  In order to do this we’ll need to get our computers set up by having the right tools for the job. Android is great because it can be done with zero software cost to begin development. The idea to create a mobile app for free is pretty awesome!

After reviewing a handful of tutorials found online, I discovered all I needed was to download and install the Android Development Tools (ADT) bundle.   It was a fairly quick and easy.  There were just a few extra steps taken from an average installation.  I installed it on a Mac OSX laptop.  Here’s how:

  1. Download the SDK ADT Bundle on the Android Developer website: http://developer.android.com/sdk/index.html
  2. After downloaded, unzip the bundle.
  3. Create a space for development in your ‘Documents’ folder if you don’t use one already. This is where you’ll put your Android projects.
  4. Place the unzipped files to your development folder.*
  5. To start using ADT.  Open the Eclipse folder within the unzipped files and find and launch it from the Eclipse icon. 

adt-bundle-mac-x##_##-######### > Eclipse > Eclipse App

*This is important: Once the ADT bundles has been moved to your development folder and you begin using the ADT you should not manually move any of the files within it.

To begin creating your first app, I found following this tutorial straightforward and helpful: http://leveluptuts.com/tutorials/Android-Development-Tutorials

Taking the time to follow each step helped me get setup relatively quickly.  I encourage you to try it out if you’ve ever been curious about Android development.  You’ll be making apps in no time!

Like to keep informed on other mobile app news and tips?