Archive for the ‘Android’ Category

All About Apple iPad

For most things that we have the iPad, the most popular feature is part of the tablet. It appears cantered aesthetic, but beauty is only a secondary factor when buying a gadget. The main objective of the acquisition of a gadget to take this opportunity to make life better to allow the user, whether for business or pleasure.

For the characteristics of consumers buying through success or failure of the agreement as a whole even if the buyer is not technically inclined, there is a way to get her latest object of affection to be able to find gadgets.

Internet is managed by iPad Safari, recently they have agreed to use Opera Mini. Safari is the fastest browser in the world, according to Apple engineers. No doubt, the source for sure, because Apple Safari. Well, for some reason they are allowed to include Opera Mini from the App Store, but not the application supports Flash. For those who farm their crops villa IPAD continues: Better Luck Next Time.

IPAD has a brilliant and sophisticated split-screen style e-mail application. If the device is placed on a child, shows both the open message and the list of emails to the inbox with an overview of two lines. Attachments, and pictures are displayed next to the text in the message. For some reason, reminds the split screen my Outlook inbox, I do not think I could be held.

The graphics are very popular iPad in vibrant colors. It uses the IPS or in-plane switching, the wide viewing angle so you look at pictures of different items and also a good view. The same applies to the cards on the IPAD allows large-screen interactive display the user to manipulate and zoom on the map for a higher resolution.

For people who gather to see and enjoy photos, there are several ways to save images in the iPad. You can import photos from your digital camera or an SD card with IPAD Camera Connection Kit, an accessory that is sold separately. IPad You can also synchronize with your computer via iTunes, and voila! “You have mentioned in your iPad photos.

Videos and movies are perfect for watching the IPAD its widescreen display and a clear effect. The battery can run for ten hours, so you can enjoy movies in your heart desires, does not see himself with a flashlight a lot. YouTube has an application that is specifically designed for Apple’s lack of Flash on the device.

IPAD course, like all Apple computers and other powers of entertainment features of the file-sharing via iTunes. This application will allow users to share Buy and download multimedia content such as music, videos and photos.

Of course, the mother of all Apple applications on the App Store, users can buy applications and content are stored in the iPad. Some 150,000 applications were made and the numbers continue to rise as the iPad begins to respond to consumers.

You can get an iPad 2 from Vodafone.com.au on a range of mobile plans – go prepaid, month-to-month or commit to a 24-month contract if you want lots of data.

C2DM on older versions of Android

Back in May, I made my Android Wish List. The #1 item on my list was push notifications. The Android team delivered in spades with Cloud to Device Messaging. C2DM is much better than push notifications as they exist in the iOS world, because the user does not have to see the message being pushed. Instead your app can have a background service process the message and decide if a notification should be shown or not. That allows apps to receive many more types of events from the cloud, since they don’t have to worry about bothering the user (or the user just ignoring the event.)

Of course there was one obvious downside to C2DM: it required Android 2.2. This is obvious, but is a bummer since it meant that developers needed to wait until 2.2 adoption became very high before they could start using C2DM. Here we are six months later, and only about half of all Android phones in use are running 2.2 (for the US, this is lower in other countries.) Who wants to ship an app that can only reach half of the universe of users, or update an existing app if half of your loyal users will be left in the cold?

This is definitely one of the places where you have to envy the iPhone. When iPhoneOS 3.0 came out, the adoption curve was pretty fast, even though users had to hook up their phone to iTunes. The reason for this was simple: OS 3.0 was available on all iDevices, and it was immediately available to everyone via iTunes. On Android, updates are pushed out over-the-air, which is great. However, it is up to vendors to do this. Plus a specific flavor of Android must be made for each Android device (this is true of iOS as well, but there are a lot less devices), and sometimes an update is not made for some devices for whatever reasons. For example, there are a large number of devices out there running Android 1.6 that will never be updated to Android 2.x.

Don’t get so down though. The point of this blog post is that all is not lost with regards to C2DM. It is actually entirely possible to add C2DM to your application, even if your application is compiled at API level 4 (Android 1.6.) Actually, it would probably work against API level 3 (Android 1.5), but there aren’t too many of those devices out there. The key is that the way that you communicate with C2DM is through Intents, no 2.2-specific APIs needed. Let’s take a look.

First things first, you still need the proper permissions and receivers setup in your manifest. In particular you need a BroadcastReceiver that receives Intents with an action of com.google.android.c2dm.intent.RECEIVE or com.google.android.c2dm.intent.REGISTRATION. The names of actions are not constrained in the manifest schema, so that you can use custom/application actions. Thus this causes no problems on devices not running Android 2.2. Check out the official docs for all of the gory manifest details.

Next, your application needs to check if the device is running Android 2.2+ or something older. If it is, then you can register for C2DM. Here’s how you check:

if (Build.VERSION.SDK_INT >= 8){    registerForC2dm();} else {    // continue to use your pre-C2DM solution here}

The only thing hacky here is that normally if you compare Build.VERSION.SDK_INT to something, it would be a defined constant like Build.VERSION_CODES.FROYO. However that constant is not available in Android 1.6, so instead we use its value of 8. I sure hope that constant doesn’t change in future versions of Android!

Finally, you need to handle the registration and message Intents that C2DM will send you. Again, you are just specifying a string for the actions on these Intents, so no API dependency. That’s it! No reflection, no compile against API level 8, but declare you only need level 4 hack (as is commonly done to enable an app to be installed on the SD card.) I’ve tested this approach on a device running Android 2.2 and on a device running Android 2.1. The 2.2 device gets C2DM messages, just as you’d hope, while the 2.1 device simply ignores the C2DM code and is unaffected.

Android Love

My colleague David Beach recently penned a great post about developing apps for Android. If you haven’t read it, go read it now. Seriously. I know a lot of you will see that he’s a product manager and stop right there, but get your lazy ass back over there and read it anyways. Look, even TechCrunch picked up his post. Ok I know that might actually be a disincentive for some of you, but still…

Anyways, I want to make a retort of sort to Beach and talk about why I love Android. However, I have to start by making a confession. My go-to phone is my iPhone 4. So why would I, an Android fanboy and somebody who is writing a book about Android development, use an iPhone 4? The answer is really quite simple. The apps are better.

My secondary device is a Nexus One, and I use it a lot. I would say I use it about 30-40% of the time. Many of the apps that I use a lot are available on both: eBay, PayPal, Facebook, Twitter, Foursquare, Yelp, Urban Spoon, Bank of America, Bump. However, in almost all cases, the iPhone app is just a lot better. This is definitely the case for the eBay app. It is most obviously the case for Facebook, which often dumps you off to their mobile web site to do things that you can’t do in the app, even though you can do them on the iPhone app. The one app that I would say more than holds its own is the Twitter app, but even there I miss the conversations feature on the Twitter app for iPhone.

It’s understandable that the apps on the iPhone are better. In many/most cases, these apps have been out 1+ year longer than their Android equivalents. So they have more features, less bugs, and are more refined in general. Further, most companies have a lot more iPhone users than Android (this is obviously changing), so they are going to invest more heavily in iPhone development. You probably want your best developer working on your iPhone app. Then again, Joe frickin’ Hewitt is doing Android development now, so the developers have arrived.

I went off on this little tangent because it actually brings us back to the original topic. I use an iPhone still because its apps are better. I claim that the apps being better is mostly because of the head start that the iPhone is still enjoying. However, you could definitely infer from Beach’s writeup (you did read it, right?) that it is easier to develop a great app for the iPhone than it is for Android. Heck, of the apps I listed earlier, the one that holds it own is the Twitter app. This is an app that was largely developed by Google — who has to scratch their Android itch by developing 3rd party apps, because they largely focus on mobile web apps instead of native apps despite their ownership of the Android platform. Maybe all of us 3rd party developers have no chance of developing a great Android app because it is just too hard?

Obviously I do not think this is the case. The challenges that Beach lays out are absolutely spot on. For designers, there is no HIG, it is very much a free-for-all. I would add that the default controls and themes are also poor. You simply must do some significant styling to your app or it will look like ass. I think some/all of this will be addressed with the Gingerbread release. It is fair to say that Apple would have never gone this route, i.e. wait until the 3.0 version of their software to focus on user experience. That is fair, and since we haven’t seen Gingerbread yet, maybe it will continue to fall short. Even if you can’t rely on the OS+SDK to make your app look spiffy, you can still do it yourself. It’s not that hard. I mean, it’s not like you have to re-invent the button or something. It just takes some experience and knowledge of what is possible with Android.

Once you get past the eye candy, many things about Android development are actually quite nice. The development environment is excellent. Yes, there will be people who just don’t like Eclipse and thus ADT, just as there are people who just don’t like XCode. However, ADT’s capabilities are quite advanced. One common complaint I have heard is about the amount of time that it takes to start an Android emulator image. This is contrast to the iPhone simulator, which starts up rapidly. However, if you consider that the Android emulator is an actual virtual machine being booted up, and not a shell that is simply relying on the underlying computer, then this is understandable. The advantages are obvious. Most apps run slower on the Android emulator than on a real device. The only advantage they may have over a real device is the network speed, but even this can be easily throttled to emulate edge or 3G conditions. If your app runs fast on the emulator, it is going to run great on a real device. You just can’t say this about iPhones apps running on the simulator.

Going beyond the tools, Android is a more advanced operating system, at least from an application developer’s standpoint. It lets you do things that are just not possible on the iPhone. The obvious thing here is multitasking. With Android’s background services, you can always have the latest data from a remote server and never have to wait for it when your application launches. Imagine if you had an up-to-the-second Twitter stream always waiting for you before you launch the Twitter app. It is possible on Android. It is not possible on the iPhone.

It doesn’t stop there. Communication between apps is formally supported on Android (though it could be improved) and can only be hacked on the iPhone. How many apps do you have that have some kind of “post it to Facebook” feature? Wouldn’t it be great if you could just use the Facebook app to handle this — thus no need to re-enter your Facebook name/password? It is possible on Android. It could sort of be hacked in a limited way on the iPhone, but it is not going to be pretty or seamless.

These are just a couple of examples. My point is that even though the UI/UX issues on Android are significant, they are not insurmountable. Once you get past them, the other advantages of Android are even more significant. As Android apps mature and Android developers mature, we should see the day where Android apps are better than iPhone apps. I don’t think that day is too far off. Now would that counter-balance the arrival of the iPhone on Verizon and other carriers? I think so.

I will conclude on a more personal note once again. I work with all of the mobile teams here at eBay, including our iPhone teams. I’ve had a much more involved role on our Android app for awhile now, and I want it to be one of the first examples of an Android app that is significantly better than the iPhone equivalent. That’s not because I’m an iPhone hater (though I’m sure we’d all agree that competition is a very good thing)  or something, it’s just because I think that by fully tapping the capabilities of the Android platform, we can deliver something incredibly useful to our users. Mobile software development is an amazing experience. Our users get to connect with our software in a much more personal way. Our software literally runs in the palm of their hands. That’s a remarkable place to be. Right now I think Android is the platform that can deliver the most in that place, and I’m going to put my money where my mouth is.

Phone Number Fixer for Android

One of the curses of working with computers is that you often become The IT person for friends and family. In fact, I should get a commission from Apple for all of the business I’ve sent their way by getting family members to switch to Mac computers. Ditto for the Firefox browser. I can’t make people switch to Mac, after all that’s often an expensive proposition, but it’s long been a condition of my help that you never even think about using IE. For some of my less computer savvy relatives, I’ve learned to make IE disappear. This just made my life a lot easier (less things to fix) especially back in the heady days of weekly IE6/ActiveX exploits. Anyways… These days most folks, including friends and family, mostly use web applications and since I’ve had them on Firefox for a long time now, there aren’t too many problems. However, recently I got an unusual request for help from a high school friend Maria.

She had just switched to a Nexus One — a phone that she seemed to be extremely happy with. She had imported several contacts from her SIM card that had been in her old phone. The only problem was that for these contacts, their phone number was classified as “Other.” That would not be a big deal, but when she would try to send a text to a number, Android’s auto-complete would not include these “Other” phone numbers as part of its search domain. So she would have to completely type out the number to send the text to — which kind of defeats the purpose of having an address book on your phone. She could manually change each of these phone numbers to be of type “Mobile”, and this would solve the problem for that number. However as you might guess, she had a lot of numbers and changing each manually would be painful to say the least. And that’s where I come in…

This sounded like an easy enough problem to solve. Find all of the numbers that were of type “Other” and change them to “Mobile.” That might not work for everyone — there might be some people who really want to classify some phone numbers as “Other” — but it certainly worked for Maria (and I would guess most people, too.) So I cooked up a quick little app. First, I wanted to display all of the numbers that this was going to affect:

ContentResolver resolver = getContentResolver();String[] fields = new String[]{People._ID, People.NAME};Cursor cursor = resolver.query(People.CONTENT_URI, fields, null, null, People.NAME);LinkedHashMap<Integer, String> people = new LinkedHashMap<Integer,String>();int id = cursor.getColumnIndex(People._ID);int nameCol = cursor.getColumnIndex(People.NAME);if (cursor.moveToFirst()){ do{  people.put(cursor.getInt(id), cursor.getString(nameCol)); }while (cursor.moveToNext());}cursor.close();

This gives you a LinkedHashMap whose keys are the IDs of each contact, and whose values are the names of the contacts. Why did I bother with these two bits of info? Well, we need the contacts to query the phones, and I wanted something friendly to display to Maria so she knew which numbers were about to get “fixed”. Anyways, now it was easy to query the phones:

ArrayList<String> data = new ArrayList&kt;String>();StringBuilder sb = new StringBuilder();String[] projection = new String[]{Phones.DISPLAY_NAME, Phones.NUMBER, Phones._ID};Uri personUri = null;Uri phonesUri = null;int displayName = 0;int number = 1;int phoneIdCol = 2;int phoneId = -1;int cnt = 0;for (int personId : people.keySet()){ personUri = ContentUris.withAppendedId(People.CONTENT_URI, personId); phonesUri = Uri.withAppendedPath(personUri,             People.Phones.CONTENT_DIRECTORY); cursor = resolver.query(phonesUri, projection,             Phones.TYPE + "=" + Phones.TYPE_OTHER, null, null); displayName = cursor.getColumnIndex(Phones.DISPLAY_NAME); number = cursor.getColumnIndex(Phones.NUMBER); phoneIdCol = cursor.getColumnIndex(Phones._ID); if (cursor.moveToFirst()){  do {   sb.setLength(0);   sb.append(people.get(personId));   sb.append(": ");   sb.append(cursor.getString(displayName));   sb.append('|');   sb.append(cursor.getString(number));   data.add(sb.toString());   phoneId = cursor.getInt(phoneIdCol);   cnt += updateContact(phoneId);  } while (cursor.moveToNext()); } cursor.close();}ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.phone, data);setListAdapter(adapter);Toast.makeText(this, cnt + " phone numbers updated", Toast.LENGTH_LONG).show();

This code just loops over the contacts we got from the first query. For each of those contacts it queries to see if the contact has any phones that are of type “Other” (Phones.TYPE_OTHER). If it does, it creates a string that shows the contact’s name, the phone’s display name, and the phone number. This string is added to an ArrayList. Once all of the queries complete, an ArrayAdapter is created using the ArrayList of contact name/phone strings and used to populate a ListView.
You might have also noticed that a there is a counter variable being incremented, and an updateContact method. This is actually the method that fixes the phone number. I probably should have just kept track of the phoneIds and then gave the user a button to initiate the fixes, but I was lazy. Here is the code for updateContact.

private int updateContact(int phoneId){ ContentValues values = new ContentValues(); values.put(Phones.TYPE, Phones.TYPE_MOBILE); ContentResolver resolver = getContentResolver(); Uri phoneUri = ContentUris.withAppendedId(Phones.CONTENT_URI, phoneId); return resolver.update(phoneUri, values, null, null);}

Too easy. Contacts are an example of a Content Provider in Android. Many people (including my Android in Practice co-author and author of Unlocking Android, Charlie Collins) have criticized Android for exposing too much of the database backing of Content Providers. As you can see from the examples above, you have to deal with cursors (moving, closing), queries, updates, and very thinly abstracted select and where-clauses. Maybe it would have been better to drop down directly to the SQL, or provide a more object oriented API. Now you can create your own Content Provider, and you don’t have to use SQL database to back it — but then implementing the Content Provider contract can be quite awkward.
Anyways, I found that the easiest way to get this little app to Maria was to simply put it on the Market. It’s still on there if you happen to have a similar problem (maybe many people switching to Android might experience this?) If you are on your Android phone you can just select this link. If you are on your computer you can scan this QR code.

Android Wish List

This Wednesday is the first day of Google I/O. Google has a lot of very interesting technologies and many of those will have some new features announced this week. However, it doesn’t seem too presumptuous to say that I/O is going to be Android-centric this year — maybe every year for awhile. Google has pitted itself firmly against Apple and its iPhone/iPad platform. So I/O is Google’s WWDC, and in case you missed it WWDC 2010 is all about mobile. And so it is with I/O.

There is a lot of chatter about Froyo, or Android 2.2. It’s browser will have an integrated Flash plugin. It’s supposed to be insanely fast (courtesy of a JIT and lower RAM usage by the kernel). It will support USB tethering and it can turn any Android phone into a mobile hotspot. That’s all great, but none of that really does much for us Android developers, except for the speed increase of course — especially important for game developers. Speaking of game artistes, Froyo is supposed to bring a lot more OpenGL ES goodness into their hands. So maybe we’ll start seeing killer games on Android. Anyways, back to developers. What’s Froyo got for us? More importantly, what do you want out of the platform? Here’s my list.

  1. Push Notifications. The iPhone has it. Blackberry has had it for what, a decade? The Windows Phone thing that’s coming out at the end of the year is supposed to have them too. But what about Android? Background services and polling? Stop F’ing with me.
  2. Apps on SD Card. Yeah we’ve been asking for this for a long time, and Google has always shot it down. Why is it important? It removes the pressure to keep apps super small, a pressure that has some chilling side effects. On the iPhone, I wouldn’t hesitate to use a 3rd party library in an app, even if it added an extra 500KB to the app size. Not so on Android. For me this is particularly acute when it comes to using other languages like Scala on Android. The runtime library size is prohibitive — because the app can’t be saved on to the SD card.
  3. More JDK. Wouldn’t it be nice to have JAXB on Android? What about JAI? Yeah I know that sometimes they just wouldn’t work because of performance reasons, but sometimes they would. Shouldn’t be up to the developer to figure out when to use it or not?
  4. Android for pads/slates/tablets. Yeah I want the Android equivalent of iPhone OS 3.2. I want to see Android on these form factors. As a corollary, I want an end to ChromeOS and that potential distraction. Let’s just have one tablet OS from Google, ok? Android: Tablet Edition will have the Mobile Chrome browser in Android, anyways right? Bonus points: A sexy device with the new OS running out given to all of the developers at I/O (I know they gave us Droids already, but I’m greedy.)

So there’s my list. What’s yours?

Update: I remembered one more thing for my wish list, though this is not directly part of Android. I want Android 2.1 (or 2.2) to be available on all Android devices. I want it running on the G1, for example. There are definitely some SDK features I’d like to take more advantage of, and that’s hard to do with 1.5 and 1.6 still on the majority of devices. The Mobile Chrome browser in 2.0+ is infinitely better than what’s in 1.6 and lower because it uses HTML5 standards for storage, offline, geolocation, etc. instead of the now defunct Google Gears. So I really want those 1.5 and 1.6 browsers to go away, it’s like having to support an ActiveX control for Ajax…

Technology News | Computer Programming | Mobile Phone Software's at AJAX Tech