Learn2Develop is a technology company specializing in hands-on training on the latest Web and Mobile technologies.
Email: weimenglee@learn2develop.net
Friday, May 27, 2011
Mobile Programming Courses in June 2011 - iPhone, Android, and Windows Phone 7
Wednesday, May 25, 2011
Come and join me in my talks at DevTeach - May 30 - June 3 2011
San Francisco - Android and iPhone Bootcamp
Friday, May 20, 2011
Weekend class - Foundation of iPhone Programming - 28-29 May 2011
iOS Bluetooth Programming - Getting devices to see each other
- (GKSession *)peerPickerController:(GKPeerPickerController *)pickerIn 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.
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;
}
Wednesday, May 18, 2011
Coming soon - Beginning Android Tablet Application Development (Wrox)
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:
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:
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:
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?
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.
<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!