Friday, May 27, 2011

Mobile Programming Courses in June 2011 - iPhone, Android, and Windows Phone 7

Here are the courses running in June 2011. If you have not registered for them yet, do so now as seats are running out.

Download course outlines and application form here.

Wednesday, May 25, 2011

Learn iOS Bluetooth Programming at DevTeach 2011

Join me in my talk at DevTeach and I will show you how to program your iOS devices to talk to each other using Bluetooth. Click the video above to see a simple example that I have developed to demonstrate the kind of things you can do with Bluetooth. See you at DevTeach!

Come and join me in my talks at DevTeach - May 30 - June 3 2011

I will be presenting 2 sessions at DevTeach 2011 (Canada). The 2 sessions are:

Building Location-Aware iOS Application
In this session, you will learn how to use the Location Manager to obtain geographical data in your iOS application. You will learn how to implement a location tracker application that allows you to log your movements, as well as how to use Google Maps to display your current location. Last but not least, you will learn some of the new location features available in the iOS SDK.

Developing Bluetooth iOS Applications
In this session, you will learn how to use the GameKit framework in the iOS SDK to develop compelling iOS applications. You will learn how to write a simple chat application that allows two iOS users to communicate. In addition, you will also learn how to use the Voice Chat feature in the GameKit to transfer voice data between two devices.

Hope to see you at DevTeach!

San Francisco - Android and iPhone Bootcamp

I will be in San Francisco from 4 to 7 June 2011. If you are looking for Android or iOS Bootcamp training during this period, give me a buzz.

Friday, May 20, 2011

Weekend class - Foundation of iPhone Programming - 28-29 May 2011

There will be a special run of the Foundation of iPhone Programming (S$997 nett) next weekend - 28-29 May 2011 (9am to 5pm). Venue is Mountbatten Square. Lunch provided.

Register now to avoid disappointment!

iOS Bluetooth Programming - Getting devices to see each other

Sometime back, I wrote an article for DevX.com on how to write Bluetooth iPhone applications. In that article, iOS devices running that program will be able to see each other when you use the GKPeerPickerController class to look for each other. So why is it that your application can only see another device running the same application, and not other Bluetooth applications running on the same device?

The reason is simple. When you use the GKPeerPickerController class to look for other Bluetooth devices, it creates a session ID. Applications will only be able to see each other if the session IDs are identical. By default, the session ID is the application's Bundle Identifier (you can see this in the Info.plist file in your Xcode project. Hence, if an application is installed on two devices, one should be able to see the other since they have the same Bundle Identifier. By default, the bundle identifier is set to: com.yourcompany.${PRODUCT_NAME:rfc1034identifier}. So if two applications have different Product Name they won't be able to see each other.

But what if you want to customize the session ID by creating your own? To do so, you just need to implement the following method:
- (GKSession *)peerPickerController:(GKPeerPickerController *)picker
sessionForConnectionType:(GKPeerPickerConnectionType)type {
if (!self.currentSession) {
self.currentSession = [[[GKSession alloc] initWithSessionID:@"Session_ID_Here" displayName:nil sessionMode:GKSessionModePeer] autorelease];
self.currentSession.delegate = self;
}
return self.currentSession;
}
In this case, devices can only see each other if their session ID are the same. The displayName argument allows you to specify the name of the device that will be seen by the other party. If you set it to nil, iOS will use the device's name.

Wednesday, May 18, 2011

Coming soon - Beginning Android Tablet Application Development (Wrox)

If you are fascinated with the many Android tablets in the market and wanted to write an application or two for these devices, check out my latest book that is coming your way soon in August. This book is geared towards those beginning developers who wanted to start writing Android tablet apps first. This book will get you started in no time.

Once you are up to speed, head over to the Beginning Android Application Development for the full gutsy gory details of Android programming.

How to change the Base SDK of your iOS Project

In the past, when you create your iOS project, Xcode will always hardcode the version number of the SDK in your project.

If you open the project using a newer version of the SDK, you will get the Base SDK Missing error:

image001

To resolve this, simply double-click on the project name (in this example, BasicUI) to open the Info window. In the Info window, select the General tab:

image002

At the bottom of the Info window, select the drop down for Base SDK for All Configurations and select Latest iOS (iOS 4.3). Once this is selected, close the Info window.

Back in Xcode, you should see the SDK number that was selected earlier:

image003

If you don’t see this, close the project and reopen it again. This time, the updated version number should appear.

Friday, May 13, 2011

Android Tip - How to intercept SMS messages and prevent them from appearing in the Messaging App?

Sometime back, I wrote an article on how to intercept incoming SMS messages in your Android application - http://mobiforge.com/developing/story/sms-messaging-android.

Ever since, I have received numerous questions on how you can prevent the incoming messages (that you are trying to intercept) from appearing in the Messaging application (and hence in the status bar). The solution to this is pretty straight-forward once you understand the concept of broadcast receivers.

Basically, your program registers a class SMSReceiver as a broadcast receiver to intercept incoming SMS messages:
       <receiver android:name=".SMSReceiver">
         <intent-filter>
             <action android:name="android.provider.Telephony.SMS_RECEIVED" />                  
         </intent-filter>
     </receiver>

When a SMS message is received, all applications (including the Messaging application) will take turn to handle the incoming message. So, in order to prevent the incoming message from being handled by the Messaging application, your application just needs to handle the message before the Messaging app has the chance to do so. To do this, add the android:priority attribute to the <intent-filter> element, like this:
        <receiver android:name=".SMSReceiver">
         <intent-filter android:priority="100">
             <action android:name="android.provider.Telephony.SMS_RECEIVED" />                  
         </intent-filter>
     </receiver>
Set this to a high number, such as 100. The higher the number, the earlier Android executes your application. So in this case, when an incoming message is received, your application will execute first, and you can decide what to do with the message. To prevent other applications from seeing the message, simply call the abortBroadcast() method in your broadcast receiver class (SMSReceiver):
        this.abortBroadcast();
Once you do this, no other applications will see your SMS message. :-) Have fun!

Sunday, May 08, 2011

Courses in May-June 2011 - iPhone, Android, and Windows Phone 7

Year 2011 marks the year of the tablet. With the new Apple iPad 2 and the new Android tablet by Google, the tablet market is set to explode in the second half of 2011 and beyond. And this is the best time for you to pick up the foundation skills so that you can get yourself ready for the next wave in mobile development.

Here are the courses for the month of May:
* Android Programming - 18-19 May 2011
* Foundation of iPhone Programming - 28-29 May 2011 (weekend classes)

And the schedule for June 2011 is as follows. Download course brochures and application form here. Venue for all classes will be at Mountbatten Square.





Thursday, May 05, 2011

Beginning iOS 4 Application Development in Korean!

Wow....I didn't know that until the books came...my Beginning iOS 4 Application Development book (Wrox) is now available in Korean!

Now, I want to know how my name is written in Korean.... :-)

For iOS courses, check out the schedule in June here.