Thursday, December 05, 2013

Android Tip - Transferring File via Bluetooth

If you want to easily transfer a file from your application to another Android device, you can make use of Bluetooth.

Beginning with Android 4.1, you can now make use of the built-in Bluetooth Sharing app available on the device. The following code snippet shows how to use an Intent object to manually invoke the Bluetooth Sharing app to send an image from one device to another:

import java.io.File;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;

...

        
        //---assuming you have a file named MyPhoto.jpg in
        // your SD card---
        File file = new File(
            Environment.getExternalStorageDirectory().
            getPath() + "/MyPhoto.jpg");
        Intent i = new
            Intent(android.content.Intent.ACTION_SEND);
        i.setType("image/*");
        i.setComponent(
            new ComponentName("com.android.bluetooth",                         
   "com.android.bluetooth.opp.BluetoothOppLauncherActivity"));
        i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
        startActivity(i);      

    }

Wednesday, November 27, 2013

Announcing the details of the Pebble Programming course

I am super excited to announce the details of the first Pebble Programming course held in Singapore. Here is the synopsis of the course and the dates:

Pebble Watch included in course fee!

In this 2-day workshop, you will learn the fundamentals of programming the Pebble watch. You will learn the difference between a Watchapp and a WatchFace app, and how to develop compelling Watchapps and WatchFace apps that you can install onto your own Pebble Watch. You will also learn how to write iOS and Android apps that interact with your apps on the Pebble watch. 

Topics
Setting up the Pebble SDK
WatchApp vs. WatchFace apps
Hello, Pebble World!
A Quick Introduction to the C Programming Language
Anatomy of a Pebble App
    Header Files
    Static and global variables
    Metadata
    Windows
    Layers
    Initializing the UI of the app
    De-initializing the app
Building User Interfaces
    Event Handlers
    Click Handlers
    Timer Handlers
    Navigating Windows
    Simple Animations
Persisting Data
    Writing to persistent storage
    Reading from persistent storage
    Deleting a key from persistent storage
Using the Pebble Accelerometer
    Using the Accelerometer Service
    Registering for Tap events
Integrating with Mobile Apps
    Using the PebbleKit for iOS and Android
    Connecting to your Pebble
    Obtaining information on Pebble
    Communicating with a Pebble app
    Launching and Killing your Pebble app
    Sending and Receiving messages
Integrating with JavaScript
    How to get your Pebble App to communicate with your JavaScript code running on the Pebble Mobile App on your mobile device
    Passing messages from Pebble to JavaScript
    Passing messages from JavaScript to Pebble

    Launching configuration page to let users customize your Pebble app

What you need to bring for the course?
    a. Need to bring along a Mac for the course
    b. Bring along your iOS or Android device

Time and Dates
9am to 5pm:

* 6-7 Jan 2014 (Mon-Tue)
* 6-7 Feb 2014 (Thu-Fri)
* 10-11 Mar 2014 (Mon-Tue)

Fees
* S$1,295 (nett; no GST) 
* Course fee includes a Pebble Watch (US$150)

Venue
Bayview Hotel Singapore
30 Bencoolen Street 
Singapore 189621

Application Form
Download Application Form here.


Monday, November 25, 2013

Wednesday, November 06, 2013

New Course - Pebble Programming! Coming soon!

I am super excited to announce of an upcoming new course on Pebble Programming! Ever wanted to create apps and watch faces for the Pebble? Now you have the chance!


Watch this space for details and schedules. For this course, a Pebble is required. No Pebble? No worries! Pebble watches will be provided for this course and you get to keep one for yourself after the course!

Get a Bluetooth Low Energy (BLE) SensorTag when you sign up for the Bluetooth Low Energy Courses

For those of you signing up for the Bluetooth Low Energy Courses (AND303 – 1-Day Advanced Android – Bluetooth Low Energy Programming and IOS301 – 1-Day Advanced iOS – Programming iBeacon in iOS7 using Bluetooth Low Energy), you will get a unit of the Ti SensorTag. 


The Ti SensorTag is a Bluetooth Low Energy (CC2541) device containing 6 sensors:

  • temperature
  • humidity
  • pressure
  • accelerometer
  • gyroscope
  • magnetometer

In the 2 courses, you will learn how to write iOS or Android apps that talk to this device to obtain the various values from the sensors. 



Wednesday, October 30, 2013

Check if your Android device supports Bluetooth Low Energy (BLE)

If you want to know if your Android device supports Bluetooth Low Energy (aka Bluetooth LE; sometimes also known as Bluetooth Smart or Bluetooth 4.0), download the checker application that I have created here. You can click on the link using a web browser on your Android device and it will automatically download the app onto your device. Just install it once it is downloaded.


This application will allow you to know if Bluetooth LE is supported on your device. You can also optionally email the results to me so that I can collate a list of devices that supports Bluetooth LE.

Want to learn how to program Bluetooth LE on your Android device? Join us in this upcoming course on Advanced Android – Bluetooth Low Energy Programming.

Wednesday, October 16, 2013

CS102 – Advanced C# 5.0 - Object-Oriented Programming - 9-10 Dec 2013

Since the release of the Microsoft .NET Framework in July 2000, the C# programming language has gone through a few revisions, with the latest version 5.0. Over the years, the C# language has gained a lot of followers, partly due to its familiar syntax to Java and C. The clear syntax of the language made it easy to learn, and is a popular choice for beginning programmers.


Coupled with Visual Studio, Microsoft’s flagship development environment, developing applications using C# is now available to a wide audience. In this fast-pace 2-day course, attendees will gain a solid foundation in C# programming. In particular, special focus will be placed on Object-Oriented Programming (OOP) using C#.

Topics
Motivations for Object-Oriented Programming (OOP)
   
Classes
    Objects
Interfaces
Inheritance
Delegates and Events
Generics
Language Integrated Query (LINQ)
Named Methods
Optional Parameters
async and await
Advanced Topics
    Threading
    Files and Streams

Course Fee
• S$997 (nett; No GST)

Download course outline and application here.

Dates
• 9-10 Dec 2013 (Mon-Tue)

Venue
Bayview Hotel Singapore
30 Bencoolen Street 
Singapore 189621

Tuesday, October 15, 2013

WEB103 – 2-Day Web Development using PHP and MySQL - 19-20 Dec 2013

PHP is a server-side script language that is designed for dynamic web applications development. It is often used in conjunction with HTML and SQL to produce dynamic web pages. In this course, participants will learn about the PHP language, as well as how it integrates with HTML to create dynamic web applications. In addition, participants will also learn how to use PHP together with MySQL databases to create data-driven web sites. 

Topics
Setting up the Development Server
Introduction to PHP
Structure of PHP
Data Types
PHP Operators
PHP Control Flow
PHP Functions and Objects
Object Oriented Programming using PHP
PHP and the Web
Working with Web Forms, Data, and Sessions
Using Cookies in PHP
Error logging and exceptions handling
Introduction to MySQL
Configuring PHP for Database Support
Creating a MySQL Database
Accessing MySQL Database using PHP

Course Fee
• S$997 (nett; No GST)

Download course outline and application here.

Dates
• 19-20 Dec 2013 (Thu-Fri)

Venue
Bayview Hotel Singapore
30 Bencoolen Street 
Singapore 189621

Monday, October 14, 2013

Foundation of iPhone Programming - 31 Oct to 1 Nov 2013


This course has been fully updated to cover the latest Xcode 5 and iOS 7. In Xcode 5, all projects use Storyboard by default and you no longer can use .XIB files when creating new projects. In addition, iOS 7 has introduced some design changes that you need to be aware of. 

Come and join us in this fun-filled and intensive course on iOS 7 programming. It would be the most worthwhile time that you ever spend on a course. 

Course Fee
• S$997 (nett; No GST)

Download course outline and application here.

Dates
• 31 Oct to 1 Nov 2013 (Thu-Fri)

Venue
Bayview Hotel Singapore
30 Bencoolen Street 
Singapore 189621

Wednesday, October 09, 2013

AND303 – 1-Day Advanced Android – Bluetooth Low Energy Programming

In recent years, we have seen a proliferation of Bluetooth Low Energy (Bluetooth LE) devices. Bluetooth LE, as its name implies, uses low energy for transmitting data.  This is very useful for devices that require long-battery life, such as heart rate monitor, temperature sensors, etc.  In Android, Bluetooth LE functionalities weren’t supported at the platform level until Android 4.3. 


In Android 4.3, you can now write applications that use Bluetooth LE. Your application can now connect to heart monitors, as well as temperature sensors using Bluetooth LE. 

Topics
  • What is Bluetooth Low Energy (Bluetooth LE)
  • Roles and Responsibilities
    • Central and Peripherals
    • GATT server and GATT client
    • Services and Characteristics
  • Testing for Bluetooth LE support in your Android devices
  • Scanning for Bluetooth LE devices
  • Communicating with Bluetooth LE sensors
  • What is iBeacon
    • Detecting iBeacons
  • Building Location Based Services applications using iBeacon
At the end of the course, you will learn:
• How to communicate with Bluetooth Low Energy devices (such as temperature sensors and heart rate monitors) from your Android applications.
• How to build location-aware applications using iBeacon.
Prerequisites 
• Attended the Foundation of Android Programming course
• Android device running at least 4.3 and supports Bluetooth LE (required)
• Android ADT Bundle


Course Fee
• S$699 (nett; No GST)

Download course outline and application here.

Dates
• 7 Nov 2013 (Thu)
• 12 Dec 2013 (Thu)

Venue
Bayview Hotel Singapore
30 Bencoolen Street 
Singapore 189621

Android Tip - Checking for Bluetooth LE Support


Bluetooth Low Energy (LE) devices has been out for quite sometime. However, support for Bluetooth LE was not available until Android 4.3. Even so, support for Bluetooth LE is still dependent on the hardware that you have running the Android 4.3.  For instance, the first generation of Nexus 7 does not support Bluetooth LE, even if you have upgraded it to Android 4.3.

Bluetooth LE is based on the Bluetooth 4.0 Specification. It is also commonly known as Bluetooth Smart.

In order to test if you device supports Bluetooth LE, add the following permissions and uses-feature element in the AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="net.learn2develop.checkforble"
    android:versionCode="1"
    android:versionName="1.0" >
 
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
   
    <uses-permission android:name=
        "android.permission.BLUETOOTH"/>
    <uses-permission android:name=
        "android.permission.BLUETOOTH_ADMIN"/>
   
    <uses-feature android:name="android.hardware.bluetooth_le"
        android:required="false"/>
 
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=
                "net.learn2develop.checkforble.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name=
                    "android.intent.action.MAIN" />
                <category android:name=
                    "android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
 
</manifest>


In the onCreate() method of your activity, use the hasSystemFeature() method from the PackageManager class to check if Bluetooth LE is supported:

import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.Menu;
import android.widget.Toast;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        String msg;
        //---check to determine whether BLE is supported on
        // the device---
        if (!getPackageManager().hasSystemFeature(
            PackageManager.FEATURE_BLUETOOTH_LE)) {
            msg = "Bluetooth LE not supported on this device";
            finish();
        } else {
            msg = "Congrats! Bluetooth LE is supported on " +
                  "this device!";
        }
        Toast.makeText(this, msg,
                Toast.LENGTH_SHORT).show();
    }

Tuesday, October 08, 2013

IOS301 – 1-Day Advanced iOS – Programming iBeacon in iOS7 using Bluetooth Low Energy

In recent years, we have seen a proliferation of Bluetooth Low Energy (Bluetooth LE) devices. Bluetooth LE, as it name implies, uses low energy for transmitting data.  This is very useful for devices that require long-battery life, such as heart rate monitor, temperature sensors, etc.  In iOS, Bluetooth LE functionalities are encapsulated in the Core Bluetooth Framework. Using the Core Bluetooth Framework, you can now write Bluetooth-enabled iOS applications that are able to communicate with Bluetooth LE devices. 


In iOS 7, Apple has taken Bluetooth LE one step further with the introduction of iBeacon. iBeacons are physical devices that use Bluetooth LE to continuously transmit its location.  When an iBeacon-enabled iOS application detects the presence of an iBeacon, the application will be sent a notification. Using the data transmitted by the iBeacons, the application can calculate the distance the user is away from the iBeacon. This is very useful for building location-based services that targets the insides of a building (such as malls and hospitals), where traditional location-based techniques are not quite adequate in knowing which floor a user is at. 
Topics
• What is Bluetooth Low Energy (Bluetooth LE)
• Introduction to the Core Bluetooth Framework
• Players in Core Bluetooth
        o Central and Peripherals
        o Services and Characteristics
• Simulating Peripherals using your iOS device
• Communicating with Bluetooth LE sensors
• What is iBeacon
• Building your own iBeacon
• Detecting iBeacons
• Building Location Based Services applications using iBeacon

At the end of the course, you will learn:
• How to communicate with Bluetooth Low Energy devices (such as temperature sensors and heart rate monitors) from your iOS applications.
• How to build location-aware applications using iBeacon.
Prerequisites 
• Attended the Foundation of iPhone Programming course
• Mac running Mac OS X Mountain Lion (10.8.5) or later
• iPhone/iPod touch/iPad (required)
• Xcode 5 or later

Course Fee
• S$699 (nett; No GST)

Download course outline and application here.

Dates
• 8 Nov 2013 (Fri)
• 13 Dec 2013 (Fri)

Venue
Bayview Hotel Singapore
30 Bencoolen Street 
Singapore 189621