Androidsx is now Perops. Visit us at perops.com

Androidsx Androidsx | android and wearable developers

 

Subscribe for market insights and new posts

 

Gitpoints

May 22, 2016 at 4:06 am | general | No comment

 
 

How to publish your Android library to be easily linked by Gradle

May 22, 2016 at 4:06 am | general | No comment

 

So, you have created a library for Android. And you want other to import it easily into their projects, such as with a simple compile 'com.androidsx:rate-me:3.0.0' in their Gradle build.gradle file.

 

New features in Java 7

September 27, 2012 at 10:37 pm | blog, general | No comment

 

Here’s a summary of the most exciting features of the upcoming Java 7, which is of interest for the Java community and, consequently, for Android developers!

Language enhancements

Left to right type inference

This basically allows you to write Map<String, List<String>> retVal = new HashMap<>(); instead of Map<String, List<String>> retVal = new HashMap<String, List<String>>();, which is unnecessarily verbose.

It also infers the type of the return type: in a method whose signature is Map<String, List<String>> parseSomething() you can just return new HashMap<>(); and have the generics information inferred.

Using strings in switch statements

A natural extension of the switch statement. No longer do we have to map those strings to integers or enums, or write error-prone anidated if statements. It’s also a bit more efficient. For details see the Compilation section in the initial proposal.

Automatic resource management

Not much ago, we spent quite some time tracking down a bug because some DB connections were not closed. In complex infraestructures (i.e., where you use Spring, define several aspects to AspectJ, but sometimes you also program at the low level for optimization purposes), this is not always a trivial topic. Making sure you free this type of resources will no longer be necessary.

With Java 7, you can write

try (InputStream is = new FileInputStream(new File("foo.txt"))) {
    // read the file and do something with it
} catch (IOException e) {
    // handle this
}

instead of the more verbose, error-prone:

InputStream is = null;
try {
    is = FileInputStream(new File("foo.txt"));
    // read the file and do something with it
} catch (IOException e) {
    // handle this exception
} finally {
    if (is != null) {
        try {
            is.close();
        } catch (IOException ex) {
            // ignore this exception
        }
    }
}

You can thank the java.lang.AutoClosable interface, that has just one method: void close() throws Exception;.

Improvements to literals

Underscores: now you can write int billion = 1_000_000_000; instead of int billion = 1000000000; in order to make sure you don’t miscount the 0s.

Binary literals: this is an obvious extension to the literals, now you can write int yourInteger = 0b100100101; // 293 in decimal.

Improved exception handling

It’s common (and not necessarily a bad sign) to deal with different exception types in the same way. Instead of duplicating code by copy-pasting the same exception routine, now we can use the OR (\|) operator to group the exceptions:

try {
    methodThatThrowsThreeExceptions();
} catch (ExceptionOne e) {
    // deal with ExceptionOne
} catch (ExceptionTwo | ExceptionThree e) {
    // deal with ExceptionTwo and ExceptionThree, even if they belong to different hierarchies
}

Somewhat related to this is the ability to rethrow exceptions with their original types, with no wrapping, and without the need to catch them separately. The following piece of code, valid in Java 7,

private void throwExceptions() throws A, B, C {
    try {
        // some operation that's declared to throw A, B or C exceptions
    } catch (Exception e){
        LOGGER.error("Caught " + e + " and rethrowing it", e);
        throw e;
    }
}

is exactly equivalent to

private void throwExceptions() throws A, B, C {
    try {
        throwAccordingToIndex(new Random().nextInt(2));
    } catch (A e){
        LOGGER.error("Caught " + e + " and rethrowing it", e);
        throw e;
    }
    catch (B e){
        LOGGER.error("Caught " + e + " and rethrowing it", e);
        throw e;
    }
    catch (C e){
        LOGGER.error("Caught " + e + " and rethrowing it", e);
        throw e;
    }
}

You could argue that you should be using AOP here for the instrumentation of this exceptions, but that’s another topic.

New I/O API version (NIO.2)

You’ve probably had issues at some point in time with working with absolute/relative paths, especially for programs that run in different operating systems. Also, deleting/renaming files lead to issues, as it did working with symbolic links. This version aims at making these uses cases easier.

Path

The class java.nio.file.Path will probably become the most commonly used in this package. It’s a substitute of our beloved java.io.Path, but better. You can do FileSystems.getDefault().getPath("hello.txt");, or Paths.get("file.data").getParent();. It’s basically simpler to use, especially in an environment with different filesystems.

Files

This utility class provides over 50 utility methods, such as copy(), move(), newInputStream(), readAllBytes(), createSymbolicLink(), …

Watch Service API

This new API lets you listen to some system events related to files and directories, such as when a new file is created in a directory. For details, check out the javadoc of the WatchService.

Fork and Join

The fork/join framework helps you make effective use of current architectures with many cores. It is an implementation of the well known ExecutorService, that uses a work-stealing algorithm to make sure that no worker threads idle by stealing tasks from those that are busy.

It seems fairly easy to use as long as you have a good way of splitting your processing needs into smaller tasks. There is a very handy guide in this tutorial by Oracle.

Dynamism

This does not affect us directly, but it’s a nice addition for the Java Virtual Machine, to which we are seriously tied to.

More and more dynamically typed languages want to leverage the JVM, but they are limited by the fact that the JVM was conceived to be statically typed, which implies that the type information is only checked at compile time, and thus the JVM executes this strongly-typed bytecoded without caring about the type information. This is a limitation for the dynamically typed languages where the type information is unresolved until runtime. A new feature, named invokedynamic, has been introduced in java.lang.invoke, which will allow to create performant, high quality implementations of such languages easier.

 

Our progress in Android development in 2011: Part 1

April 25, 2012 at 10:01 pm | android, blog, general | 5 comments

 

Let us share what we did in 2011 in the Android development field. Not that it is extraordinary in any way, but it may be interesting for some folks out there working on side projects, for you to see an example of what you can get done in a year of evenings and weekends. We’ll write follow-up posts on the topics that you guys want to know more about. Let us know in the comments!

During 2011, we had over 1.6 million downloads of our applications. These new users, together with the existing ones, generated 24 million interaction sessions with our applications. We worked on six new projects, and launched four of them. Here’s an screenshot from our Flurry stats:

Flurry stats for Androidsx in 2011: 1.6 million new users, 24M sessions

Q1 2011

For our Spell Checker and Spell Checker PRO, we tried out different monetization alternatives, and also experimented with the prices. Every week or two (depending on how significant the amount of collected data was), we’d perform a single change, either in the price, or the way we link from the Free to the Pro versions, the name, etc. Then, we measure the relevant metrics (conversion rate, number of purchases, or number of new downloads, typically) to evaluate if the change was positive or not. We also implemented some user-requested features on the graphical user interface (e.g., character count, most-used actions always visible).

All this paid off, as the revenue doubled from the initial to the optimised configuration. For the free version, we’ve been consistently getting over 100 thousand new users per month. It’s quite impressive, considering how simple the application is, and how little time it takes from us now: it has run on auto-pilot for the better part of its life, almost two years now.

We collaborated with Luis Solano to launch an iPhone version for it, iSpellChecker. This version got some attention from the national media, but it didn’t gain a lot of traction.

Screenshot of iSpellChecker

Also, we did some minor enhancements on our TFLN widget, a widget based on our AnyRSS news reader that reads from the public RSS feed of the TFLN website. Our Admob and Mobclix ad campaigns were remarkably effective there, yielding pretty high eCPM (see our post on this: Admob vs Mobclix comparison). The TFLN site owners argued it was against their Terms of Service to have this application in the market, so we unpublished TFLN.

A couple of weeks before Saint Valentine’s day, we thought, would it be profitable to launch an event-specific application? For instance, a $1 application that provides a curated, categorized, collection of gift tips for Saint Valentine’s day. To answer this question, we thought we just had to go ahead and try. We decided two days is the maximum amount of time we’d put into it. Indeed, in a weekend we hacked out and published an application named Valentine Ideas. The conlusion? No, it’s not that easy. We only had 15 purchases. Well, it was fun, anyway.

Screenshot of our Saint Valentine's app

Q2 2011

Together with Juny Crespo, we started a new project, named Deals To Me. It is an Android application that provides coupons that are active near the user, filtering the results from several coupon providers. We hired Hugo Doménech to help us with the development of the client side. In this wiki space, you can find an early draft, the code of the running prototipe we built, and some more internal documentation.

Three months into the development, we decided to cancel the project. The niche of coupons had changed a lot since we first conceived the idea somewhere in mid 2010. The main reason behind this decision was, fundamentally, that we were late in the game, where many strong players were already so well positioned.

During those weeks, we had a idea based on a common use case of ours: we’re at some friend’s place, and want to show them the pictures from the trip last weekend. We thought, wouldn’t it be cool to just press a button in your phone, and then have the photos from my phone displayed in the computer in some way that’s comfortable to watch?

Two months of work after this, we published Remote Gallery 3D in the Android market, that targets this exact use case. During 2011, we had 230k downloads of the free version, and a bit over 1k purchases of the full-featured 3.95 USD Remote Gallery 3D+ version that we launched in the end of November. We were happy with the launch, and thrilled to get so many nice comments and high ratings from users, but still feel it could rank much higher on the Android market. There’s a lot of room for improvement there, especially in terms of marketing and positioning.

Remote Gallery 3D

To be continued …

This is a summary of what we got done in the first half of 2011. Within a couple of weeks, we’ll talk about the second half of the year, and share our thoughts on where we could’ve done better.

Would you want us to go into more detail in anything in particular? Let us know!

 

Hello android world!

October 6, 2009 at 2:50 pm | blog, general | 22 comments

 

This is where we share our experience with the Android platform. Also, find articles about software quality and testing that we will write in a weekly basis.

This is where we share our experience with the Android platform. Also, find articles about software quality and testing that we will write in a weekly basis.
 

Categories:

Recent posts:

Search:

Subscribe