Archive for category How to

VAT on EEC Sales on the Android Market

As I work through my own UK limited company that’s registered for UK VAT, there are a few complications selling applications on the Android Market. When I submit an application at a particular price, my company needs to charge VAT at 17.5% on all sales to buyers in the European Economic Community countries.

[As an aside, you are selling the application, not Google. Google is deemed as a payment processor, much like a bank, and isn't selling your application.  If it were, you would have to charge Google VAT on the sale (price less commission) of the application to them and they would have to charge VAT on the higher price sold to customers - this is the usual retail position for physical goods]

There are two options:

1) Leave the price ‘as is’ and take a hit on the 17.5% VAT. This means for a £2.00 application, I am charged £0.60 commission by Google and have to pay £0.30 to the UK tax authorities.

(Note that it’s not £0.35. The price net of VAT is £1.70 + (.175 x £1.70) = £2.00)

This means £1.10 is received for every sale which isn’t good. My company pays corporation tax at 21% so my company profits by £0.86. It also means I have to go through every sale to work out if it’s in the EEC.

2) Charge VAT only to EEC Customers. Google Checkout allows this under Settings… Tax Setup. This means for a £2.00 application it will be sold for £2.34 to people in the EEC and £2.00 to those outside the EEC. This means £1.70 is received for every application and the company profits by £1.34 which is significantly more. Google also conveniently accounts for VAT and I just need to download the .csv files each month and total the VAT.

The downside of this is that the EEC user initially sees £2.00 as the price and ends up paying £2.34 at the Checkout. This might put people off paying (VAT registered companies can reclaim the VAT). It might be argued that Google Checkout should be showing the VAT inclusive prices.

Also, companies or individuals selling on the Android Market, who are not VAT registered, don’t need to charge VAT and are at a competitive price advantage.

Fixing Speaker Buzz and Emulator Crash

Unfortunately, the Android emulator doesn’t always work well with desktop sound. This can cause the desktop speakers to start buzzing just after boot. The emulator also crashes and it’s not possible to close it.

The solution is to turn off sound support in the emulator. You can do this by adding -noaudio to the emulator command line. Open Run Configurations and select the Target tab. Add -noaudio to the ‘Additional Emulator Command Line Options’…

targetnoaudioObviously, you won’t be able to hear or test sound if you use this option.

How to Send an Email

Another common requirement is to send an email from your application. At first, this looks easy. You use an ACTION_SEND Intent as demonstrated by the example on OpenIntents

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "email text");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
sendIntent.setType("message/rfc822");
startActivity(Intent.createChooser(sendIntent, "Title:"));

However, this sends the email via the Android mail app in the phone, prompting you which email app if you have more than one configured. So, how do you send an email silently? It turns out that there’s no official way to send an email directly (via SMTP). The Google rationale is that, for security reasons, the user needs to know (and confirm) that the application is sending an email on their behalf.

However, what if you still want to send silent emails? One option is to port a 100% Java SMTP library. You might try JavaMail. There’s a .jar file on the Google groups but I wouldn’t use it if I were you as it doesn’t respect the original source code license and you don’t really know what you are including.

There’s another attempt at putting together bits and pieces with more details how to go about this yourself but it’s really lots of hacking which most people might like to avoid. Someone else has also claimed to port gnu inetlib.

If you want a cleaner way of sending via SMTP, without polluting your application with lots of unwanted classes, then one solution might be to get your server to do it via a simple php script and send up the information via a http GET or POST.

How to Detect Call State

Some applications need to do clever things whenever there’s an incoming or outgoing call. There’s a great example of this in the source code for ‘five’ (an app providing remote access to your PC’s music collection) where the music PlaylistService listens for incoming calls so it can temporarily pause playback…

TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
tm.listen(mPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);

and…

private PhoneStateListener mPhoneListener = new PhoneStateListener()
{
        public void onCallStateChanged(int state, String incomingNumber)
        {
                try {
                        switch (state)
                        {
                        case TelephonyManager.CALL_STATE_RINGING:
...
                                break;
                        case TelephonyManager.CALL_STATE_OFFHOOK:
...
                                break;
                        case TelephonyManager.CALL_STATE_IDLE:
...
                                break;
                        default:
                                Log.d(TAG, "Unknown phone state=" + state);
                        }
                } catch (RemoteException e) {}
        }
};

In many applications, the next stage is to do something based on an incoming telephone number. The number is given by the String incomingNumber parameter shown above.

Also don’t forget the following in your manifest…

<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>

How to do Text to Speech

TTS 1.4 has very recently become available on the Android Market. TTS has been created by Charles Chen, Software Engineering Team and T.V. Raman, Research Scientist at Google.

You can use the TTS library in your own applications. There are also some hints and tips how to use TTS in your application.