Slatedroid info

Everything about android tablet pc [slatedroid]

This is what the Android Nanodegree entails

Posted by wicked June - 2 - 2015 - Tuesday Comments Off


One of the ‘lesser’ announcements Google made at last week’s I/O 2015 keynote was the new Android Nanodegree, which aimed to offer a crash course in Android development and offer an insight into the lifecycle of Android app development. Today, the Redmond-based company has revealed exactly what the Nanodegree entails and if you’re interested in becoming a marketable Android developer, you’ll definitely want to read on.

Partnered with online education specialist Udacity, the Android Nanodegree program lasts for between six and twelve months at a cost of $200 per month. The course covers everything from the fundamentals of Android and app development to advanced development skills and also focuses on Google Play Services and Material Design.

Today’s update on the Android Developers blog reveals the finer details and one specific point; the Nanodegree contains the same courses that are individually available for free but subscribing to the Nanodegree “gives you access to coaches who will review your code, provide guidance on your project, answer questions about the class, and help keep you on track when you need it“.

The other element to the Nanodegree is that it’s based on the skills and projects in your portfolio and – unlike a traditional degree program – you can skip the courses that address the skills you already possess. As Google’s own post says:

You can focus on writing the code and building the projects that meet the requirements for the Nanodegree credential.

So what does the Android Nanodegree actually entail? Google has also outlined the individual courses that make up the degree:

Is the Nanodegree a good move by Google? It certainly is, for a couple of reasons: first, it offers developers the chance to gain a credential that can set them apart from other developers and secondly, it allows Google to train developers to create apps that meet its own standards. Given that the courses themselves are available individually for free, it remains to be seen how many people are willing to spent $200 per month to get access to help when they need it.

Google I/O 2015 in videos:

What do you think of the Nanodegree? Would you pay $200 per month for Google’s help to build your app and gain a credential that will allow you to market yourself better? Let us know your views in the comments below!

Google’s new app rating system now live on web, mobile

Posted by wicked June - 1 - 2015 - Monday Comments Off

A few months back, Google told developers that there will now be a new app rating system, based on which region you submitted the app to. The questionnaire that they submitted will be reviewed by the appropriate body and then the app will be given a rating, depending on the standards of that region. Now that rating system has gone live, on the web version, and is still rolling out to the mobile version of Google Play Store.

You’ll be able to see the new age and region appropriate ratings under the app ratings on the web version of the Google Play Store. They would vary sometimes depending on which region you submitted it to. For example, one of the review bodies is the International Age Rating Coalition and in the US, the ratings are as follows:

E – Suitable for all ages, but may also contain minimal, mild violence (as with cartoons, fantasy elements), and occasional use of “mild language”

E10 – For everyone, 10 and above

T – For teens, 13 and up. Content may include juvenile, crude humor, a little bit of blood, simulated gambling and “possibility of strong language”

M – For age 17 and up because it contains intense violence, sexual content, and strong language

AO – For adults only, ages 18 and up, because of the addition of graphic sex and gambling with actual money

Developers would have to fill up a content-related questionnaire before they submit their product to Google Play Store and then Google will pass it on to review bodies who will give the appropriate rating. Even existing apps had to have their content ratings done as well. The ratings are still rolling out for the mobile version of the Google Play Store but is already visible on the web version, if you’d like to check them out.

VIA: Android Central

Java basics: a tutorial for beginners

Posted by wicked May - 28 - 2015 - Thursday Comments Off

Update, May 28: Added video.

Original post, April 17: If you have ever wanted to write your own Android app, for fun or for profit, you are probably going to need to do some programming. There are lots of different ways to write Android programs but the official language of Android is Java. If you don’t want to try your hand at Java, then I would recommend you read my article: I want to develop Android Apps – What languages should I learn?

Not only is Java the official programming language for app development, Java itself is used by Google for large parts of the Android internals. There are two distinct parts to writing an Android app. One is the Java programming language itself, the other is understanding how to create an app in terms of its user interface, the Android OS, and the Android Software Development Kit (SDK). In this tutorial we will deal with the first of these, the Java programming language.


To start writing Java programs you need a way to compile source code and turn it into an executable for the Java runtime.

Java was first released in the mid-1990s by Sun Microsystems. It was designed to be easy to learn by programmers who already knew C and C++. During 2006 and 2007 Sun released Java as free and open-source software, under the terms of the GNU General Public License (GPL). Sun was bought by Oracle in 2009/2010, and Oracle remains committed to Java.

To start writing Java programs you need a way to compile source code and turn it into an executable for the Java runtime. The normal way to do this is to install the Java Development Kit. At the time of writing the current version of Java is Java 8, however it is relatively new, so Android uses Java 7. If you are unsure about installing the JDK then read this How to Install the Java Software Development Kit tutorial. Oracle also provides a JDK 7 Installation Guide.

However, if you aren’t quite ready to install the JDK, and you want a quick route to trying your first Java program, then I recommend Koding gives you access to a free virtual machine with all the compilers and tools you need to compile and run Java programs as well as develop in other languages like Go, Python, Node, and C. To sign up just visit, type in your email address and a password of your choice, and then click “Sign Up”.

The virtual machine (VM) comes with an IDE and command line access. The web view of the virtual machine is divided into four. On the very left if the Koding control panel with access to your account details, the virtual machines you have created and so on. Next to it is a file manager which shows all the files and folders you have on your VM. Next to that the screen is split into two. The top half is an editor, for writing your code; and the bottom half gives you command line access.

From here in I will assume you are using Koding. However, for those who have installed the JDK the process is almost identical except that you will need to use a text editor on your PC rather than the editor inside the Koding IDE.

Cut and paste the following code into the editor:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World");

And save it as In Java the filename of the source code and the class name must be the same. The first line of the code declares a class called HelloWorld, so this source code must be saved in

In Koding to save the file, hover the mouse over the tab for the code (probably called Untitled.txt) and click on the little arrow. Then click “Save As…”, enter as the file name and click “Save”.

At the bottom part of the screen is the command line. The virtual machine is running Linux and the terminal is running Bash. If you are unfamiliar with using the Linux command line, try this tutorial: Linux Tutorial for Beginners, especially Tutorial One and Two. So, to compile your first Java program just type:


The compile should only take a second or two. Then to run the program type:

java HelloWorld

Your reward is the text “Hello, World” being displayed in the terminal. Congratulations!


What did I just do?

So let’s take a moment to look at what just happened. First the source code. The file does three things. 1) It declares a class called HelloWorld. 2) It defines a method (a function) in the HelloWorld class called main. 3) The main() method calls System.out.println to output some text.

In Java, and in all object orientated programming languages, a class defines an object. An object is a self contained item that interacts with other objects. In Android such object would include elements in the UI, a network connection, some location data, and so on.

Each Java program must define a method called main in at least one class. It is the entry point, where the program starts executing. In the simple example above the main() method has just one line of code, a call to System.out.println to output “Hello, World”. println() is a method that belongs to the PrintStream class and is included as part of the System class. Oracle has lots of information about the System class and the PrintStream class.

To compile and run the program you first called javac and then java. The first is the Java compiler, hence the letter ‘c’ at the end, and the second is the Java virtual machine. Java is architecture-independent which means that a .java file isn’t compiled for a specific processor on a specific OS, like Windows on an Intel x86 chip, or Android on an ARM Cortex-A processor, but rather it is turned into Java bytecode. The job of the Java virtual machine is to run that bytecode on the specific platform.


When writing computer programs you will need to store some data for temporary use. For example in an Android game you will want to store the score of the current player. These bits of data are stored in variables – a box in which you can put some data and then come back later a retrieve it. Since data comes in different forms a variable needs to be defined with a type, which tells Java what is being stored. Some of Java’s primitive data types include int (for integer), double (for double precision floating point number), and boolean (for a true/false value).

Here is a simple program which sets the value of a variable, prints out the value to the console, changes the variable and then prints it out again:

public class VariableTest {
    public static void main(String[] args) {
        int i = 1;

        System.out.println("The value of i is: " + i);
        i = i + 24;
        System.out.println("The value of i is now: " + i);

Save the file as “”. To compile it type: javac, and to run it use: java VariableTest. The output of the program will be:

The value of i is: 1
The value of i is now: 25

As you can see the program defines a variable called “i” and gives it an initial value of 1. The value of “i” is printed to the console. Then i is set to the new value of i + 24, or 1 + 24, which is 25. The new value is then printed out.

Try modifying the program to use a “double” rather than an “int”. Set “i” to something like 1.3 and increase its value by another decimal number like 24.9.

If you take a look at the println() method you will see an integer being added to a string: “The value of i is: ” + i. What actually happens here is that Java knows that the first part of the expression is a string, so it generates the string value for i, in this case “1” and then concatenates it to the string giving: “The value of i is: 1″.


Strings are an important part of any programming language including Java. Unlike int or boolean, a string isn’t a primitive type it is a class. When you create a string variable you are really creating a String object (notice the capital letter S). As an object it has certain properties like its value (the string itself) and its length. Strings can be manipulated in lots of different ways, including being dissected, concatenated, compared, and searched.

Here is an example program that performs a few simple operations on a String:

public class PlayingWithStrings {
    public static void main(String[] args) {

        String hello = "Hello, World";

        // Add an ! to the end
        hello = hello + "!";

        // Extract the word "Hello" from the String
        // i.e. starting at the beginning (0) for 5 characters
        String justHello = hello.substring(0,5);

        // Add some trailing spaces and then remove them with trim()
        hello = hello + "     ";
        hello = hello.trim();

        // Now output the string all in UPPERCASE and lowercase

Save it as Compile it and run it using javac and java as shown previously.

This is a special method called a constructor. The constructor is called only once, at the moment that the object is created.

The first part of the program creates a String object called “hello” and gives it a value of “Hello, World”. Although this make look similar to how you declare and assign an integer or another primitive type, actually there is a lot more going on here. Java allows simple operators like = and + to be assigned simple tasks. So really String hello = “Hello, World”; is actually some like String hello = new String(“Hello, World”);, in other words, create a new object of type String and pass in the value “Hello, World” to the constructor. But we will talk more about that in the Objects section below.

The next part shows how you can concatenate strings, in this case an exclamation point is added to the end of the string. Since String is an object it can have methods. String.substring() is a method which returns part of a string. In this case the first 5 characters. String.trim() is another method which removes leading and trailing spaces. The last part of the program demonstrates the String.toUpperCase() and String.toLowerCase() methods.

The output from the program will be:

Hello, World
Hello, World!
hello, world!

You can find out more about the String object in Oracle’s String tutorial and from the Java String documentation.


If there is one thing a computer is good at, it is doing repetitive tasks. To perform a repetitive task in a programming language you use a construct called a loop – something that loops around again and again.

Java has three types of simple loop: the for loop, the while loop, and the do while loop. Each loop type follows the same basic idea, you need to repeat something over and over again until a certain condition is met.

Here is an example which shows how to print out the numbers 1 to 10, 11 to 20, and 21 to 30, using the three different types of loop:

public class Loops {
    public static void main(String[] args) {

        // For loop
        for(int i=1; i<=10; i++) {
            System.out.println("i is: " + i);

        // While Loop
        int j = 11;
        while(j<=20) {
            System.out.println("j is: " + j);

        // Do While Loop
        int x = 21;
        do {
            System.out.println("x is: " + x);
        } while (x <=30);

Create a file called with the code from above, then compile it and run as shown previously.


The for loop as three parts. First the initialization (int i=1), which is executed only once. In the example above the initialization is used to declare an integer i and set its value to 1. Then comes the test expression (i<=10). This expression will be tested every time the loop executes. If the result of the test is true then the loop will go around again. In this example the test is to check that i is still less than or equal to 10. After each iteration the third section, the iterator, will be executed. In this example it increases the value of i by one. Note that i = i + 1 is the same as i++.

The while loop is similar to the for loop, except it doesn’t contain the initialization phase and the iterator phase. That means that the initialization needs to be done separately, hence the declaration int j = 11;. The iterator also needs to be coded separately. In our example it is the line j++ which is found inside the loop after the println().

A do… while loop is very similar to a while loop with one big difference, the test to see if the loop should continue is at the end of the loop and not at the start. This means that a do… while is guaranteed to execute at least once, but a while loop doesn’t even need to execute at all, if the conditions aren’t met on the entrance into the loop.

Like the while loop, the initialization needs to happen outside the loop, in this case: int x = 21; and the iterator occurs inside the loop: x++. When x goes over 30 the loop will stop.


As I mentioned before, Java is what is known as an object-orientated (OO) programming language and to really succeed in Java programming and Android programming it is important to understand OO concepts.

At its simplest level an object is a set of methods (functions) that work on a data set. The data and the methods belong to the object, and work for the object.

Here is the source code for a very simple program which creates a counter object:

public class Counter {

    int count;

    public Counter() {
        count = 0;

    public void Increment() {

    public int GetCount() {
        return count;

    public static void main(String[] args) {
        Counter myCounter = new Counter();

        System.out.println("mycounter is " + myCounter.GetCount());
        System.out.println("mycounter is " + myCounter.GetCount());

The Counter object has one piece of data, the integer variable count and three methods (other than main): Counter(), Increment(), and GetCount(). Leaving the first method for the moment, you can see that Increment() and GetCount() are very simple. The first adds one to the internal variable count and the second returns the value of count.

Until now all the methods we have declared started with public void but if you notice the GetCount() method starts with public int. We will talk more about public in a moment, but the difference between void and int is this: void declares that the method doesn’t return anything, there will be no result coming back out of the method. But int tells us that the method will return a number, specifically an integer. You can actually create methods that will return all kinds of data, including objects.

Notice that the first method has the same name as the class itself, i.e. Counter(), and it doesn’t have a return type (not even void). This is a special method called a constructor. The constructor is called only once, at the moment that the object is created. It is used to initialize the object with default values and perform any other necessary initialization tasks. In this example it just sets count to zero.


The great thing about classes is that you can create a general class for an abstract idea and then create specific classes which are derived from the original class. For example, you can create a class called Animal and then derive a new class from it for a specific animal, say an Elk.

Here is an example, I will expand on what is happening here in a moment… You are going to need to create two files for this example, and Here is

public class Animal {
    int NumberOfLegs;

    public Animal(int n) {
        NumberOfLegs = n;

    public int GetNumLegs() {
        return NumberOfLegs;

And here is

public class Elk extends Animal {
    int lengthOfAntlers;

    public Elk(int l) {
        lengthOfAntlers = l;

    public int GetAntlerLength() {
        return lengthOfAntlers;

     public static void main(String[] args) {
        Elk myElk = new Elk(30);

        System.out.println("Antler: " + myElk.GetAntlerLength());
        System.out.println("Legs: " + myElk.GetNumLegs());

To compile the program just type:


The Animal class is what is known as a super class, while the derived class Elk is known as a sub-class, because hierarchically it is below the Animal class. When a class is extended (i.e. you create a sub-class) the new class takes on the data and methods of the super class. That is why the program is able to call myElk.GetNumLegs() even though it is part of the Animal class. The new Elk class has two variables: NumberOfLegs and lengthOfAntlers. It also has two methods: GetAntlerLength and GetNumLegs. If we created another sub-class, say Sheep, it would inherit the NumberOfLegs variable and the GetNumLegs method.

When designing objects you will discover that you want some methods to be exposed to the rest of the program, so that they can be called. But other methods you might want to keep private, so that only the object itself has access to it. This is where that word public comes into play. We have been declaring everything as public which means the method can be called from anywhere else in the code. However you can declare methods as private or protected, which will limit the access to those methods. The same access rules can also be applied to the object’s variables. A deeper discussion is beyond the scope of this tutorial, but if you would like some more information then you should read Controlling Access to Members of a Class and Declaring Member Variables from Oracle’s Java documentation.

One other thing worth mentioning is how the constructors work. The Elk() constructor initializes the lengthOfAntlers variable, in this case to 30, the number passed in when the object was created. But before that, it calls the constructor of the super class (i.e. Animal() ) using the special Java notation super.

There is a lot more that can be said about object-orientated programming (OOP), but this should be enough to give you a taste and get you started.

Wrap up

There are lots of online tutorials for learning more about Java. Here are a few from Oracle:

  • Getting Started — An introduction to Java technology and lessons on installing Java development software and using it to create a simple program.
  • Learning the Java Language — Lessons describing the essential concepts and features of the Java Programming Language.
  • Essential Java Classes — Lessons on exceptions, basic input/output, concurrency, regular expressions, and the platform environment.

You might also want to look at the following tutorials:

For those of you who would like an eBook or a printed book on Java programming then you might want to consider the following:

Also, good books on Android programming include:

Android Developer Newsletter

Do you want to know more? Subscribe to our Android Developer Newsletter. Just type in your email address below to get all the top developer news, tips & links once a week in your inbox:

PS. No spam, ever. Your email address will only ever be used for Android Dev Weekly.

How to code a simple Android widget

Posted by wicked May - 22 - 2015 - Friday Comments Off

App widgets can be thought of as a small window or controller for an Android app that can be embedded in another application (like the homescreen). They can be very useful, allowing users to view or control an app without actually launching it. For example, skipping tracks with a music player widget, or viewing weather information. The great thing about widgets is that they can be updated automatically (after a time period), or in response to user action.

In this developer tutorial, we are going to create a simple Android widget, that updates automatically every 30 minutes, or in response to the user tapping the update button on the widget. Our widget generates and displays a random number on every update (whether automatic or due to user interaction).

To create a widget requires four steps:

  1. Design the widget layout. At the very least, you will need one layout file describing your widget layout. However, you can also provide additional layout files for
    • The widget before it receives any data.
    • The widget on a lockscreen (Android 4.0 and above).
    • The widget on a lockscreen before it receives any data (Android 4.0 and above).
  2. Extend AppWidgetProvider. This class provides methods that are called during a widget lifecycle.
  3. Provide the AppWidgetProviderInfo metadata. Essential information about the widget, such as minimum width and height, update frequency, and more.
  4. Add the widget to your application manifest.

1. Design the Widget layout

The first thing we do is design our widget layout. While laying out an app widget is similar to laying out an activity and/or fragment, there is a very important factor to note. App Widget layouts are based on RemoteViews layouts. This means that not all View subclasses can be used in a widget. In fact, the only supported classes are FrameLayout, LinearLayout, RelativeLayout, GridLayout, AnalogClock, Button, Chronometer, ImageButton, ImageView, ProgressBar, TextView, ViewFlipper, ListView, GridView, StackView and AdapterViewFlipper. Subclasses and descendants of these are not even supported.
With this in mind, we design our widget layout, named simple_widget.xml

<LinearLayout xmlns:android=""





Note android:padding in the above code snippet. From Android 4.0, app widgets automatically get a padding between the widget frame and the widget bounds. Pre-4.0 devices however do not provide the automatic padding for widgets. To build a widget that has margins for earlier versions, but no additional margins for 4.0 and above, create two dimension resources res/values/dimens.xml and res/values-v14/dimens.xml to provide different values for widget margin, and set your targetSdkVersion to 14.


    <dimen name="widget_margin">8dp</dimen>


    <dimen name="widget_margin">0dp</dimen>

Extending AppWidgetProvider

Now extend AppWidgetProvider, by creating the class SimpleWidgetProvider. AppWidgetProvider has methods that are called when the app widget is updated, deleted, enabled and disabled among others. For our implementation, we only override onUpdate(), because it is the method called whenever the widget is added to a host.

public class SimpleWidgetProvider extends AppWidgetProvider {

    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        final int count = appWidgetIds.length;

        for (int i = 0; i < count; i++) {
            int widgetId = appWidgetIds[i];
            String number = String.format("%03d", (new Random().nextInt(900) + 100));

            RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
            remoteViews.setTextViewText(, number);

            Intent intent = new Intent(context, SimpleWidgetProvider.class);
            intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
            PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
                    0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
            remoteViews.setOnClickPendingIntent(, pendingIntent);
            appWidgetManager.updateAppWidget(widgetId, remoteViews);

In the onUpdate() method above, we iterate through all of our widgets (in case the user has placed multiple widgets), get a RemoteViews object, update the RemoteView’s textview with a new random number between 100 and 999, and then specify the action that should occur when the Button is tapped.
To request a manual update when the update button is clicked, we use a PendingIntent. The action for the Intent is set to AppWidgetManager.ACTION_APPWIDGET_UPDATE. This is the same action sent by the system when the widget needs to be updated automatically. We also indicate the widgets that should be updated (all of the app widgets) by calling

intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds).

To update the current widget only, you can call

intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);

Finally, we request the AppWidgetManager object to update the app widget, giving it the current widgetId and the current RemoteViews object.

Providing AppWidgetProviderInfo metadata

This is an xml file that defines additional information, features and data related to the widget. Data such as minimum layout dimensions (width and height), if the widget should be available on the lock screen (Android 4.2 and above), how frequently the widget should be updated, among many others. We define an xml file, called simple_widget_info.xml, and saved in the res/xml folder.

<appwidget-provider xmlns:android=""

Most of the attributes have pretty self explanatory names. minWidth and minHeight specify the minimum width and height the widget can have. updatePeriodMillis specifies the update frequency in milliseconds for the widget. Note that frequent updates will significantly affect users battery. Take note of the widgetCategory attribute. This specifies if your widget can be available on the lock screen as well as on the home screen. All widgets are available on the home screen by default, and if not specified. Android 4.2 included the keyguard option, indicating that the widget can be added to the lock screen.
If your widget is displayed on a lock screen, you might want to show different data, or a different layout. To detect if the widget is on a lock screen, you request the widget options using AppWidgetManager’s getWidgetOptions(int widgetId) method. This method returns a bundle, which can be queried for the AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY int. This will either be a WIDGET_CATEGORY_HOME_SCREEN or WIDGET_CATEGORY_KEYGUARD.

The sample code below checks for the AppWidgetHost, and displays a different layout for each host type.

AppWidgetManager appWidgetManager;
int widgetId;
Bundle myOptions = appWidgetManager.getAppWidgetOptions (widgetId);

int category = myOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, -1);

// If the value is WIDGET_CATEGORY_KEYGUARD, it's a lockscreen widget
boolean isKeyguard = category == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD;

int baseLayout = isKeyguard ? R.layout.keyguard_widget_layout : R.layout.widget_layout;

Declare Widget in the Application Manifest

The final step is to add the app widget to the application manifest. Within the <application> </application> element tags, add the following

        <receiver android:name="SimpleWidgetProvider" >
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            <meta-data android:name="android.appwidget.provider"
                android:resource="@xml/simple_widget_info" />

Don’t forget to change the receiver android:name to your AppWidgetProvider implementation, an the meta-data android:resource to your AppWidgetProviderInfo xml file. At this point, you should be able to run your application, and place your widget on either the home screen or lock screen.

Tapping on the update button should automatically update all your widgets. Can you modify your code to only update the widget that was tapped? How about updating only one random widget on tap? Have fun with this, but remember that a widget that updates frequently will be a drain on the battery.

As usual, the complete code is available for modification and reuse to your hearts content on github.

More money made from mobile ads on Android than on iOS for the first time ever

Posted by wicked May - 11 - 2015 - Monday Comments Off

One of the primary ways that app developers make money from their apps is from mobile advertising. This is especially true of apps which are free to download and don’t contain any in-app purchases. For a long time it has been conventional wisdom that app developers make more money on iOS than on Android. However things started to change about a year ago.

At the beginning of 2014, we witnessed a big change for mobile advertising: Android overtook iOS as the top platform for traffic. In the world of mobile advertising, “traffic” means the number of mobile ad impressions served.  Now a year on and Android dominates the market. Over 65 percent of all mobile ad impressions go to Android devices, which is a huge growth from the 42.8 percent of Q1 2014. In comparison iOS devices get around 22 percent of the ads, of which 17 percent going to iPhones and the rest going to iPads and iPods (i.e. models in the iPod Touch range).


However, although Android was getting more ads, the amount of money made by developers was still higher on iOS. App developers get money in several different ways depending on the mobile advertising platform and the types of ads displayed by the app. Primarily the developers make money when a user taps on an advert, or alternatively there are some schemes where the developers gets money per 1000 ads shown.

45.77 percent of mobile advertising revenue comes from Android, while 45.44 percent comes from iOS.

Until now the combination of the number of taps and the price paid by advertisers for their adverts to be displayed meant that iOS generated more income for developers. But that has changed. For the first time ever, Android is leading revenue generation, albeit by a hair’s breadth.

According to Opera Mediaworks, the advertising arm of the web browser maker, 45.77 percent of mobile advertising revenue comes from Android, while 45.44 percent comes from iOS. It has derived these numbers from its own mobile advertising platform, however it more than likely reflects the overall trend in mobile advertising across all the platforms.

Are you an app developer with apps on both iOS and Android? See any changes in Android income recently?

mbed – Everything you need to know

Posted by wicked May - 7 - 2015 - Thursday Comments Off

When autoplay is enabled videos will start playing automatically, you can turn off autoplay by clicking checkbox.

ARM’s range of Cortex-A processors power a bewildering range of devices from Single Board Computers, like the Raspberry Pi 2, to massive servers like HP’s Moonshot servers. You also find them in phones, tablets, media players, and Chromebooks – they are everywhere. But ARM also makes a range of microcontrollers, which are just as popular, maybe even more so. In 2014 alone, ARM’s partners shipped some 4.4 billion Cortex-M microcontrollers.

A microcontroller is like a microprocessor (i.e. the Cortex-A range) in the sense that it is a CPU, but with some bits missing. You won’t find a microcontroller using a GPU, nor a complex memory management unit (MMU), for virtual addressing. They normally run at speeds of around 100MHz (or less) and they only have a few Kilobytes of memory.

So what are they for? Basically for all the jobs that are beneath a full blown microprocessor. For example, the display on a oven or the control circuits of your washing machine will use a microcontroller, rather than a microprocessor. Some wearables, like the FitBit, use microcontrollers, as do various touch screen medical devices. You will find them in cars, in toys, in ceiling fans, in smart locks, in musical instruments, and in entertainment systems. In fact, the list just goes on and on.

For hobbyists and developers, probably the most interesting area for microcontrollers at the moment is the Internet of Things (IoT). The ability to connect everyday devices to the Internet, and use the data they send to make intelligent decisions.

Anyone with high school level programming experience can start programming an mbed board.

Now you might think that microcontrollers sound quite complex and inaccessible. But actually they aren’t. Thanks to ARM’s mbed platform you can get hold of a small board with a microcontroller on it for around $10 or $12. There are even whole IoT starter kits which provide network enabled microcontroller boards, and the software you need to start sending sensor data up into the cloud.


Before going on, it is worth mentioning the different microcontrollers in ARM’s Cortex-M range. There are current 6 Cortex-M microcontrollers: Cortex-M0, M0+, M1, M3, M4, and M7. The M0 is the smallest and the silicon for the chip can fit onto the cross section of a hair!

As you go up the range the microcontrollers increase in complexity and speed. The M3’s microarchitecture includes branch speculation and 32-bit hardware divide, while the M4 adds DSP extensions and the ability to add a floating point unit (FPU). The M7 is ARM’s latest microcontroller and offers greater performance, and more features. For example, it offers 2 times the DSP performance than the M4.


The Development Environment

The key thing about the mbed platform is that all you need is a web browser and a USB connection to start programming. The development environment is all web based. From within your web browser you can write code and compile it to give you a binary. When you plug the board into your computer, via USB, it will appear as a flash drive. To copy your program on to the board all you need to do is drag-and-drop the binary from your downloads folders drive. Hit the reset button on your board and your program will start running.

The language of the mbed platform is C and C++. That means anyone with high school level programming experience can start programming an mbed board. And you don’t need to worry about re-inventing the wheel, the mbed platform provides a whole range of libraries so that your board can communicate with other peripherals and with the outside world. For example, there are libraries for networking, USB, LCDs & displays, audio, motors, actuators, sensors, NFC, barcodes, DSPs and so on.


If you don’t like the sounds of developing via the web for a long term project, then no problem. All of the code and libraries can also be exported for use by other tool chains, including the GCC compiler.

Later this year ARM will release the next iteration of its mbed platform which will include mbed OS and the mbed client. mbed OS is a new operating system designed for IoT devices, that enables them to securely connect to the rest of the world. It will be open source and is designed specifically for ARM’s Cortex-M range of microcontrollers. The mbed Client is a set of core libraries which will allow mbed OS programs to be ported to Cortex-A based computers and boards running Linux. In other words, you can develop an IoT or other network aware program using mbed OS on a Cortex-M microcontroller, and then simply (with just a quick recompile) port it to boards like the Raspberry Pi or the ODROID C1.

The Boards

At the time of writing there are over 50 different mbed boards available. Everything from simple Cortex-M0 based boards with no integrated peripherals, to boards with built-in displays, accelerometers, networking, Wi-Fi. There are boards with cellular connectivity, boards with Bluetooth and even a robot.

To help give you an idea of what is possible with the mbed platform I am going to look at four boards and see what each one is capable of doing. The first board is the FRDM-KL25Z from Freescale.




The KL25Z uses a Cortex-M0+ Core clocked a 48MHz, and includes 16KB of RAM plus 128KB of flash. It comes with a built-in 3 color LED, a 3-axis accelerometer, and a capacitive touch sensor. This makes it a great starter board. You can pick one up for just $13.

In the world of microcontrollers the simplest program you can write is one that will flash a LED on and off. It is equivalent to the “Hello, World” program that is so often used during programming language tutorials.

To write the “blinky” program for the the KL25Z, in fact to write it for almost any mbed board, you go to and login. Click on the “Compiler” button at the top-right of the page and wait for the compiler window to open.

On the top right of the IDE, above “Workspace Details”, you will see your current selected mbed device. If this is the first time you are using mbed then it will simply say “No device selected.” Click on it and then click “Add Platform.” This will then open the platforms page on the website. Click on the FRDM-KL25Z, and then on “Add to your mbed compiler.” Back at the compiler, click the currently selected device again (or “No device selected”) and click on FRDM-KL25Z. Last step, click on “Select Platform.”


To get the source code for the blinky example, click on the Import icon from the toolbar. Find and select mbed_blinky, and then click “Import!” Once the import is done you will see the following C program:

#include "mbed.h"

DigitalOut myled(LED1);

int main() {
    while(1) {
        myled = 1;
        myled = 0;

The line DigitalOut myled(LED1); defines a variable called myled which is linked directly to a pin on the board. The pin in this case is LED1, which as you have already guessed is the LED. Because mbed knows about the board, this is sufficient at this time, you don’t need to know exactly which pin it is. When you buy the board you will get a small card with all the pins listed.

The rest of the code is simple. The program enters an infinite loop and repeatedly sets myled to 1, then pauses, then sets it to 0, then pauses and so on. This, of course, makes the LED flash.

To compile the program click on “Compile” in the toolbar and then drag and drop the resulting .bin file to the board. Hit the reset button and the program will start to run.

Nordic nRF51822

Nordic nRF51822

The nRF51822 uses the Cortex-M0 microcontroller clocked at just 16MHz and includes 16K of RAM plus 128K of flash. In terms of performance, that might seem like a step backwards when compared to the KL25Z, but the nRF51822 is special in that it has built-in Bluetooth 4.1 and includes a battery slot so that the board can be independently powered by a single 2032 coin-cell battery. The Cortex-M0 is designed for the lowest possible power usage and is therefore perfect for standalone Bluetooth applications.

And this is where Android is important, like a FitBit or other wearables, this board is the perfect building block for a device that communicates with an Android handset over Bluetooth Low Energy (BLE).

One of the example programs given on the mbed site is a Bluetooth Low Energy heart rate monitor. The program configures the board to send out (fake) heart beat information using the standard Bluetooth profile. It is actually quite simple to add an actual heart beat monitor. To test it you can use a program like Pixels Perception’s BLE Scanner. The scanner will search for BLE devices in range of your phone and then allow you to access the information that the board is transmitting, in this case a (fake) heart beat.

Getting yourself up and running with the BLE example is very similar to the way you get blinky running. You need to make sure you have the nRF51822 selected as your platform, and you need to import the BLE_HeartRate program. Once the program has been compiled and loaded on to your board, start the BLE scanner app on your Android phone and look for the device. It will be called “HRM1.”

mbed LPC1768 + application board


LPC1768+application board-720p

The LPC1768 doesn’t look like much on the outside, but on the inside it is quite different. As well as sporting a Cortex-M3 processor, it has 32KB of memory and 512K of flash, but more importantly it has built-in support for Ethernet and USB (as a host or a device). The power of the LPC1768 can be seen when you connect it to its application board. The board comes with an impressive set of peripherals and sensors included a 128×32 graphics LCD, a RJ45 Ethernet connector, a 5 way joystick, 2 x potentiometers, a speaker, a 3 axis accelerometer, 2 x servo motor headers, a temperature sensor, and a socket for a Zigbee.

Although you wouldn’t build a finished product around the application board in this prototype form, it certainly makes a good springboard for building something like an IoT device. For example, you can use the temperature sensor on the board together with the Ethernet connection to periodically upload the current room temperature to a cloud service like ThingSpeak.

It would also be possible to integrate the board with your Android device, again using a service like ThingSpeak. You could write an app to send commands to your LPC1768 to perform home automation tasks, ask it for specific sensor data, or even get it to perform a task for you like Tweet something or send an email. In fact the only limit is your imagination.




If you want something that is a bit more fun than IoT devices then I recommend the mBot from Outrageous Circuits. It is an mbed enabled robot with reflective sensors, LEDs and a buzzer. On first power up, mBot is loaded with software that makes it dance on a table without falling off. It does so by reading the two reflective sensors on the front. If it detects no reflection, it knows that it is off the edge of a table and it will backup and turn.

It only costs $30 and provides a great introduction to microcontroller programming. Outrageous Circuits provide all the source code for the default program and it also provides full documentation including schematics, pin-outs and hacker guides.

Wrap up

As I mentioned earlier, there are over 50 boards available that support mbed. These four are really just a brief overview of some of the things you can do with a Cortex-M microcontroller and the mbed platform. Once you add in communication with your Android smartphone, or connectivity with the cloud, then the possibilities are endless.

Have you tried mbed? Do you have a neat IoT idea? Please let us know in the comments below.


Lighting, console level graphics & ARM – 5 things developers need to know

Posted by wicked May - 7 - 2015 - Thursday Comments Off

ARM Mali feature

If you have ever seen a 1980s science fiction movie, or if you have ever played a 1980s computer game, then you will understand when I say that computer graphics have come a long way in the last few decades. At the dawn of the computer graphic age it was all about wireframes and simple texture mapping. Now we live in the time of photorealistic rendering with the use of shaders and advanced lighting techniques.

The challenge for 3D game makers, and for GPU designers, is to find ways to create the most realistic rendering of a scene while using the smallest amount of computing power. The reason is that 3D games, even those on Android devices, run at high frame rates ranging from 25 frames per second (fps) right up to 60 fps. In other words, the GPU has less than 1/60 of a second to turn a huge load of graphics data into a realistic rendering of a scene.

The quicker the objects, shadows, lighting, and reflections can be rendered, the greater the fps. And high frame rates mean smooth gameplay. Quick render times also mean that game designers can create increasingly complex scenes, something which further adds to the realism.

1. ARM isn’t just a CPU designer

The vast majority of smartphones and tablets use processors with ARM designed CPU cores, but ARM doesn’t just design CPU cores, it also designs GPUs. In fact over 50% of all Android tablets and over 35% of smartphones have ARM designed GPUs. Marketed under the brand name “Mali,” the GPU finds its way into almost every category of smartphone including high-end devices. The Samsung Galaxy S6 uses a Exynos 7420 SoC with four ARM designed CPU cores, and the ARM Mali-T760MP8 GPU.

During GDC ARM demonstrated an upcoming Unreal Engine 4 plugin for its Mali Offline Compiler.

For game designers the popularity of the Mali GPU means it is essential that games are tested and optimized for the Mali GPU. As you would expect, ARM provides a comprehensive set of developer tools for game designers. Among the tools you will find the Mali Graphics Debugger, which allows developers to trace OpenGL ES and OpenCL API calls in their application, and understand frame-by-frame the effect on the application to help identify possible issues; the OpenGL ES Emulator, which helps software development and testing of the next generation OpenGL ES 3.1 applications via PC emulation; and the Mali Offline Compiler, a command line tool that translates vertex, fragment and compute shaders written in the OpenGL ES Shading Language (ESSL) into binary shaders for execution on Mali GPUs.

If you want to see what is possible with ARM’s GPU specific tools then I recommend reading Profiling Epic Citadel via ARM DS-5 Development Studio, which shows how these tools can be used for performance analysis and optimization.

2. ARM will soon release an Unreal Engine 4 plugin for its Mali Offline Compiler

During GDC ARM demonstrated an upcoming Unreal Engine 4 plugin for its Mali Offline Compiler. It will allow you to analyze materials and get advanced mobile statistics while previewing the number of arithmetic, load & store and texture instructions in your code. Here is a demo of the new plugin:

The reason this type of tool is important is because it gives game makers the tools need to port games from the console/PC space to mobile. Typically content on the XBOX/PS3 is at 720p, but the Google Nexus 10 displays games at 2.5k. The challenge for game makers is to maintain a high level of gaming experience while optimizing for the power budget of a mobile device.

3. ARM is developing new GPU techniques

The engineers at ARM do more than design GPUs, they also help create and develop some of the latest 3D graphic techniques. The company recently demonstrated a new rendering technique for creating dynamic soft shadows based on a local cubemap. The new demo is called Ice Cave and it is worth watching before reading further.

If you aren’t familiar with cubemaps they are a technique which has been implemented in GPUs since 1999. It allows 3D designers to simulate the large surrounding area that encompasses an object without straining the GPU.

If you want to place a silver candlestick in the middle of a complex room, you can create all the objects that make up the room (including the walls, flooring, furniture, light sources, etc) plus the candlestick, and then fully render the scene. But for gaming that is slow, certainly too slow for 60 fps. So if you can offload some of that rendering so that it occurs during the game design phase, that will help improve speed. And that is what a cubemap does. It is a pre-rendered scene of the 6 surfaces that make up a room (i.e. a cube) with the four walls, the ceiling and the floor. This render can then be mapped onto the shiny surfaces to give a good approximation of the reflections that can been seen on surface of the candlestick.

It is also possible to get an even better experience by combining the cubemap shadows with the traditional shadow map technique.

Since the pre-rendered cubemap includes all the views from every possible angle then it doesn’t matter where the camera is in the scene, the GPU can simulate the reflections. This approach is much quicker than rendering the whole scene. This approach has had several major developments over recent years and the technique was refined significantly in 2004 and 2010.

The Ice Demo shows off a new local cubemap technique. Sylwester Bala and Roberto Lopez Mendez, from ARM, developed the technique when they realized that by adding an alpha channel to the cubemap it could be used to generate shadows. Basically, the alpha channel (the level of transparency) represents how much light can enter the room. If you want to read the full technical explanation of how this new technique works then check out this blog: Dynamic Soft Shadows Based on Local Cubemap. Below is a short walk-through of the Ice Cave demo by Sylwester:

It is also possible to get an even better experience by combining the cubemap shadows with the traditional shadow map technique, as this demo shows:

4. Geomerics is an ARM company

Lighting is an important part of any visual medium including photography, videography and 3D gaming. Film directors and game designers use light to set the mood, intensity and atmosphere of a scene. At one end of the lighting scale is Utopian science fiction lighting, where everything is bright, clean and sterile. At the other end of the spectrum (sorry, bad pun) is the dark world of horror or suspense. The latter tends to use low lighting and lots of shadows, punctuated by pools of light to grab your attention and draw you in.

There are many different types of light source available to game designers including directional, ambient, spotlight and point light. Directional light is far away like sunlight, and as you know sunlight casts shadows; ambient lighting casts soft rays equally to every part of a scene without any specific direction, as a result it doesn’t cast any shadows; spotlights emit from a single source in a cone shape, like on the stage in a theater; and point lights are your basic real-world light sources like light bulbs or candles – the key thing about point lights is that they emit in all directions.

Simulating all this lighting in 3D games can be GPU intensive. But like cubemaps, there is a way to shortcut the process and produce a scene that is good enough to fool the human eye. There are several different ways to create realistic lighting without all the hard work. One way is to use a lightmap bake. Created offline, like a cubemap, it gives the illusion that light is being cast onto an object, but the baked light won’t have any effect on moving objects.

Another technique is “bounce lighting”, here game designers add light sources at strategic positions in order to simulate global illumination. In other words, a new light source is added at the point where a light would be reflected, however, it can be hard to achieve physical correctness using this method.

Enlighten takes the pre-baked lightmap approach one step further by using a unique and highly optimized runtime library that generates lightmaps in real time.

A third is to use Enlighten from Geomerics. Enlighten takes the pre-baked lightmap approach one step further by using a unique and highly optimized runtime library that generates lightmaps in real time. The lightmap is created using the CPU during the gameplay, and is subsequently added to the rest of the direct lighting on the GPU.

This means that now the lightmap technique can be applied to moving objects. When combined with offline lightmaps only the lights and materials that need to be updated at runtime will use any CPU time.

The result is a technique that doesn’t only apply to mobile games, but one that can scale up to PC and consoles.

The subway demo below shows Enlighten in action. Note how during the “dynamic translucency” part of the demo some walls are destroyed allowing light to pass where it was previously partially blocked, however the indirect lighting remains consistent. This all happens in real-time and is not something pre-rendered just to create the demo.

5. Enlighten 3 includes a new lighting editor

To achieve such great lighting, Geomerics has released a new lighting editor called Forge. It has been specifically developed for the needs of Android game artists, and provides an immediate “out of the box” experience. It is also an important tool for “integration engineers,” as Forge serves as a model example and practical reference for integrating Enlighten’s key features into any in-house engine and editor.

One of the really useful features of Forge is that it provides the ability to import and export the lighting configurations you have set up for your scenes. This is particularly useful for defining certain lighting conditions or environments and then simply sharing them (via export) across your other levels/scenes.

For a quick tour check out this Introduction to Forge article.

A/B testing may be on its way to the Google Play Store

Posted by wicked May - 5 - 2015 - Tuesday Comments Off


A new report this morning indicates that Google plans to announce A/B testing within the Google Play Store for app developers. The announcement is scheduled to take place at the Google I/O conference at the end of the month. The idea is that developers could use the Play Store to do some market testing in an effort to increase the revenue generated by their apps.

With A/B testing, developers will be able to setup two different entries in the Play Store for their apps, an “A” and a “B” version. The app pages will be the same except for one item that developers could change. It could be something as simple as the icon used for the app or it could be something like two different prices being shown. Developers could then assess how the two versions perform to see whether a change they may be exploring will yield better results.

source: The Information
via: 9to5Google

Come comment on this article: A/B testing may be on its way to the Google Play Store

Google is experimenting with Dart to create faster, smoother Android apps

Posted by wicked May - 4 - 2015 - Monday Comments Off

A group of Google developers is working on Sky, a Dart-based “experimental, high-performance UI framework for mobile apps.”

The majority of Android apps are written in Java, but Sky makes use of Dart, an open-source web programming language developed and promoted by Google. The goal of Sky is to allow the creation of faster apps that can run on any platform and can make use of better web integration for a better user experience.

Fast, smooth apps should be the norm in our day and age, but unfortunately not all Android apps attain the 60fps gold standard at which animations are perceived as smooth. According to its creators, Sky makes it possible to create apps that consistently run at 120fps. The team used Dart on Android to create this simple demo app that renders entire frames every 1.2 milliseconds, much lower than the 8 milliseconds required to hit 120fps. But even complicated apps should be able to fit within the 8 milliseconds limit.

In order to hit this impressive frame rate, the “jank-free” Sky prioritizes the UI over other processes, meaning the app should stay smooth when it works heavily in the background.

Sky works on top of the Dart virtual machine so Sky apps can work on Android, but also on other operating systems that have a Dart VM. And because Dart is primarily a web app language, Android apps made with Sky have most of their code stored on a web server, which makes it much easier to update them: instead of updating code on every device, developers only need to update the code on the server.

For now, Sky is billed as an experiment, but the project holds great promise. Ars Technica has a closer look at Sky and the possibilities it opens here.

ARM widens the appeal of its IoT OS with mbed client that runs on Linux

Posted by wicked April - 30 - 2015 - Thursday Comments Off

mbed OS-the end-to-end software ecosystem for IoT

The race for the hearts and minds of IoT developers is in full swing and ARM has been positioning itself as the defacto standard for IoT devices. Based on its hardware alone that isn’t an unreasonable proposition, but to sweeten the deal ARM has been working hard on its software offering.

Back in October of last year ARM announced its new operating system that will run on IoT devices, and enable them to connect to the rest of the world. Called ‘mbed OS’, it is a free operating system for ARM’s Cortex-M range of microcontrollers. These processors are less complex versions of the Cortex-A processors that you find in smartphones or tablets. They are ultra-low power, running at around 100MHz (or less), and are perfect for collecting sensor data.

Until now mbed OS has been exclusive to the Cortex-M, which meant that if you want to build an IoT device with mbed OS you had to be using a microcontroller based board. But now ARM has announced a companion to mbed OS called mbed Client, a set of core libraries which will allow mbed OS programs to be ported to Cortex-A based computers and boards running Linux.

As long as the code is calling the mbed APIs, it will work on any ARM platform from a Cortex-M microcontroller board right up to a 48 core ThunderX based server.

In other words, you can develop an IoT or other network aware program using mbed OS on a Cortex-M microcontroller, and then simply (with just a quick recompile) port it to boards like the Raspberry Pi or the ODROID C1.

mbed OS provides a large number of features aimed at accelerating IoT prototyping and development. It has built-in support for important IoT connectivity standards like CoAP and LWM2M, and provides stacks for Bluetooth, 6LoWPAN, and of course IPv4 & IPv6. It also provides some important security features including TLS, which is enabled by default for all application level communications.


The mbed client is a slightly cut-down version of the full mbed OS. “Cut-down” because many of the functions provided by mbed OS, like networking stacks, are already provided by Linux. However all the important application facing components like CoAP, LWM2M, and TLS are includes in the client. This means that the same C++ code can be run on an mbed enabled microcontroller board and on a Raspberry Pi 2, without any need to change the code. As long as the code is calling the mbed APIs, it will work on any ARM platform from a Cortex-M microcontroller board right up to a 48 core ThunderX based server. Now that is true flexibility!

Like mbed OS, the mbed Client software will be released as open source. ARM is on track to release the public beta of mbed OS in August, which is when the mbed Client should also make its first appearance to the public.

Now, here is a challenge for all you Android hackers out there, what we need now is a port of the mbed Client to Android (and/or Android Wear) using the NDK. Any takers?