Monday, December 15, 2008

JSON framework with iPhone SDK 2.2

This is something that has cost me several hours after I upgraded to iPhone SDK 2.2. I have also documented it in the iPhone Discussion Forum but here is a brief summary.

If you going to use the JSON framework with the iPhone SDK 2.2 then there will be some problems. I could no longer link the framework to my application. For some reason Apple has changed the code signing behaviour. To get around it you need to add the JSON framework source code to your XCode project. 

1. Get the source code from:

svn checkout http://json-framework.googlecode.com/svn/trunk/ json-framework-read-only

2. Then copy that source code into your project directory (or use XCode add existing file...). 
3. Where you used :
#include <JSON/JSON.h> 
now you have to use:
#include "JSON.h"

and (as Dom pointed out)
#import "SBJSON.h"
#import "NSObject+SBJSON.h"
#import "NSString+SBJSON.h"

4. Build should be OK now.

Check out also http://jtribe.blogspot.com/2008/11/json-and-restful-web-services-on-iphone.html for more JSON / iPhone information.

Wednesday, December 10, 2008

Sending MMS with Android

Following on from my last post about saving a view as an image, today I want to demonstrate how to send this image via MMS. We used this technique in our application, PinPoint to send out maps via MMS. 

I have previously written about how to send SMSs with Android intents and while sending MMS via intents goes to the same application, the intent that needs to be constructed is quite different. The intent requires the following items to be set:
  • the action set to be ACTION_SEND
  • the mime type set to image/*
  • a Uri extra inserted with the key Intent.EXTRA_STREAM
  • optionally some text body with the key sms_body
Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.putExtra("sms_body", "some text"); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
sendIntent.setType("image/png"); 

The url being passed to the Uri.parse method should be of the form used to access the media store such as content://media/external/images/media/23. The previous article of views and images returns a url String that can directly be used by this MMS intent. 

Monday, December 8, 2008

Saving a view as an image with Android

Our Android application PinPoint can send map images via MMS and email. We used the following technique to be able to convert the MapView into an image that could be used across applications. 

Firstly create a Bitmap object with the appropriate width and height of your view, along with a configuration. RGB_565 seems to work just fine for the MapView canvas.

Bitmap image = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.RGB_565);

Next create a canvas with the bitmap and pass that into the draw() method of the view. This will ask the view to draw it's contents onto the canvas and therefore the associated bitmap.

view.draw(new Canvas(image));

Next insert the image into the Media library. This returns a URL that refers to the stored image and can be reused across applications. In our case we could pass this URL to the MMS application to have it embed the image in a message.  I'll post some sample code of how to send this image via MMS shortly.

String url = Images.Media.insertImage(getContentResolver(), image, "title", null);

To test this in the emulator you'll need to setup an external storage device otherwise you'll see an error like :-
java.lang.UnsupportedOperationException: Unknown URI: content://media/external/images/media

First you'll need to create a storage image using the mksdcard from the tools folder of the emulator
mksdcard 10M sdcard.iso

Then when you start the emulator you need to pass the -sdcard parameter 
-sdcard /sdcard.iso

In my next post I'll write up how to send this image via MMS

Sunday, December 7, 2008

Sending SMS using Android Intents

You've got an Android application and you want to send an email, sms and mms via your application. But you don't want to have to write a whole mail/mms/sms client. Thankfully Android provides a flexible way to forward responsibilities onto other applications installed on the device.

Android uses the concept of intents to enable applications to make requests for other applications to handle their tasks. For example, an application finds your location and wants to send it as a map via MMS. 

This can done by by constructing an Intent object, loading it up with the appropriate action, data and sending off to the operating system. 

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("scheme://data"));
sendIntent.setType("mime/type");
sendIntent.putExtra("key", "value");
startActivity(sendIntent); 

Android then decides which activity can best handle this intent based on various attributes such as scheme (mailto, http) and mime type (image/png). 

If multiple applications could handle the intent (if you're sending an image), then you can even prompt the user to choose which application they want to use (email,MMS, IM)

startActivity(Intent.createChooser(sendIntent, "Title: ");

This all sounds too easy to be true. And it is. The reality is that in order to invoke mail,sms and mms I have needed to dive into the Android source code (thank goodness for Open Source!). I wanted to invoke each of these applications, filling in as much of the content as possible. The documentation for Intents even suggests this is possible to attach images, set subjects and body text. 

To invoke the SMS application via intents you have to do the following:
  • Set the action to ACTION_VIEW
  • Set the mime type to vnd.android-dir/mms-sms
  • Optionally add any text by adding an extra String with the key sms_body 
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "The SMS text"); 
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);   

Android also enables you to send SMS directly using an API without bringing up the SMS application. However it is much more transparent to the user to allow them to see what they are sending and maybe add or edit before it goes out. Using Intents also means you can minimise the permissions your application requires.

Sending MMS and email is a much longer story which I'll get into in some later posts.  Stay tuned!


Android is listening but still has a way to go

Thank you Google for listening when we told you what we hated about Android.

The whole platform wasn't initially looking very democratic. Firstly the Market place was loaded with applications from a private selection of developers. After a period of no information, suddenly the market was open to everyone. Well everyone who could get access to a physical device.

If you live in the US and you're prepared to sign up to a two year contract with T-Mobile, then you could test your application on a physical device (as you should) and you could view the Market Place. Everyone else could only develop with the emulator and hope for the best when releasing it to the Market Place. Even worse, most developers could not see what other applications were already out there. Maybe that application already existed, maybe with the same name!

Ignoring this potential for conflict, once the app is out in the Market Place, developers can see the rating and the number of comments. What they can't see is the content of the comments (although from what I'm told the content is mostly of a youtube level anyway).

On top of all this, developers have also had to contend with a very buggy interface that sometimes showed incorrect download counts and reset everything when uploading an update.

Thankfully, Google are listening. This past weekend Google started offering unlocked devices for $399 to developers worldwide. I've even noticed the Market Place statistics are a lot more stable. What is really missing now is being able to view the Market Place on the web outside of a T-Mobile device. Hopefully this, along with the ability to charge for apps will be their next move in early Jan 2009.

Thursday, December 4, 2008

Becoming Micro Social

Anyone wants to go for lunch?
How would you use your social networks to find out who is around and wants to come along for lunch right now? Would you twitter or would you ask your Facebook friends?

Venus vs Mars Social Network
Someone told me a while ago that Facebook is the feminine social network and Twitter is the masculine social network. Why? Because Facebook is rather closed and personal where friends are known and trusted (hmm). Twitter is more a leader-follower platform where you can follow your micro tribe leader or become one yourself. Makes kind of sense to me - I prefer Twitter and I am male.

Address Book vs Networks
Facebook and LinkedIn are great tools to manage large networks of contacts that grow organically. One thing that really becomes more and more a problem is that the Address Book on the mobile phone does not reflect the contacts in our social network sites. It seems like most social network sites like to import our contact list (e.g. from Google).

Who controls your contacts?
I feel in total control of my contact list that lives on my mobile phone. Who is in control of my contacts on Facebook & Co? I guess it's me too. I personally feel still more comfortable with the phone list.

Power to the user!
I would like to state here that I want to use my contact list on my mobile phone as the basis for my next social network. So the contacts stay with me and I have complete control and privacy about who I know. No, I am not paranoid - I am just annoyed that more and more people give away the control over their address book. They give it to the large social network sites. I believe it belongs to the user!

Micro Social Networks based on your Address Book
Last week we had a great discussion at jTribe based around the problem "Anyone wants to go for lunch?". We would like to build a social application for iPhone and Android that can be used to help answering the question of "who is around and what are they doing". One thing was clear straight from the beginning: We don't want to create Yet Another Social Network Website like BrightKite. 

We basically have these three constraints:
  1. Not another Social Network Site
  2. Works on iPhone and Android
  3. The Social Network will only need to exist for a limited time
Sometimes it is great to work under constraints because it forces your mind to think differently and to follow avenues you would not have thought of before. The solution for our problem was so simple.

Use the Address Book on the mobile phone as the basis for a Micro Social Network. 

Some theory
Some articles define Micro Social Networks as networks with special interest. We want to use the word Micro in Micro Social Network as something that describes the limited scope of the social network that is established in an ad-hoc manner from a small subset of contacts in your address book (that's a mouth full. Nano Social Network would be another option to name this baby). So basically, I have an intention right now and would like to know which friends would react to this intention. In our case it is the intention of having lunch with friends. This intention has only a limited time span. To organise a spontaneous lunch I would only need 1 hr. Within that hour I could establish a micro social network which would cease once we meet for lunch. During that time any contact in the micro social network can invite any of their contacts. Any participant in the micro social network can add any participant to their address book. This provides an easy way to add a friend of a friend to the address book.  

What's next?
jTribe is going to develop social mobile device applications that allows a user to establish tiny social networks on the fly to address the challenges that mobile social people have right here and right now. Our first concept application is now running on Android. The iPhone version is following soon. 

Anyone who wants to get involved is welcome!

Related articles:

Tuesday, December 2, 2008

Application Segmentation in the AppStore

The Apple AppStore has now more then 10,000 applications on the shelf.

We thought it is time to talk about our findings and assessment of the different consumer and application segments we came across in the AppStore. For the sake of gloabalisation I am going to use US Dollar in this blog entry.

1. The Free App
New iPhone users like free apps because they are free. Isn't it part of our human nature to gather stuff? Yes, iPhone users that are gatherers go for the most popular free apps. What value do free apps offer? Promotional apps and light versions might be nice for a week or so. Apps that complement an exiting service such as Facebook. LinkedIn or Google are actually very useful. It kind of makes sense for those apps to be free since they make their revenue via their web site. I like the Facebook-like apps on the iPhone better than the web2.0 based overloaded desktop browser version. The iPhone forces the app to be simpler than on a large screen browser.

We found: The ratio between downloading a free app and using a free app is very low. Getting 50% of consumers that have downloaded a free app to actually use it regularly is a good result. 

I personally decided to limit my number of free apps on the iPhone because it start to get cluttered. I can see how apps that offer some addition interaction channel for free can justify to be free (Facebook, Linkedin, Remember the Milk, Google, etc)

2. The Almost Free App (aka 99cent app) 
New iPhone users also like the 99 cent apps. Statements like "limited time only" make the common app-gatherer to grab the app. Maybe it has to do with the fact that a song in iTunes is more expensive than a 99cent app - makes the app look like a bargain. Maybe the iTunes Store users are also conditioned by the music downloads. You download a song and keep it forever. Seriously, no one wants to keep an app forever on the iPhone. 

Developers seem to use the 99 cent prize tag to make it from the "recent" page to the "most popular" page. If you don't become popular your sales numbers will degrade continuously. 

We found: People are starting to realise that most 99 cent apps are trashware. Often the app description raises a false expectations and users are disappointed once the app is installed. 

I personally do not longer buy 99 cent apps. I started to be very selective. Most 99 cent apps are trashware anyway. I often ask myself "why are they selling for for 99 cents. Is it value or just a cheap low quality app?". Started last week to delete some 99cent apps from the iPhone.

3. The Value App
Value apps are more expensive than 99 cent and less expensive than $3.99. Consumers see them as being valuable because they solve a particular problem well combined with a realistic prize tag. The app is stylish and simple. Often the developers of 1.99 app wants to distinguish themselves from free and almost free apps by sending the message "We think this is better than the 99 cent stuff"

4. The Quality App
The 9.99 apps covers this segment. I like apps like Things and agree with the price tag of $12.99. The developers did a great job and should be rewarded for their work because we want to see more of those well-designed apps. 

5. The Niche App
These apps can pretty much ask any for any prize. Maybe justified because they will have only a small customer base. I have no niche app on my iPhone but I can imagine that some business or professionals are happy to get an app that makes their job easier.

I noticed some app in the navigation category that offers nautical maps. Why should they not charge $59 for those?

6. The Crazy App
There are always some smart developers that try to charge people $1000 for literally nothing. Get 2 customers and you made more money than the 99 cent apps selling 2000 times. 

Prediction:
My predication is that the prizes will become more real and consumers have to expect to pay between 2.99 and 9.99 for useful apps. 

My personal target is to have less than 7 free apps, 5 apps for 99 cents,  5 apps between 2.99 and 9.99, one app between $15 and $30.

I will not hesitate to delete 99 cent apps and through them out or replace them with new 99 cent apps. I think I would hang on to any value (2.49 - 3.99) and quality app (9.99).