Showing posts with label heart rate monitor. Show all posts
Showing posts with label heart rate monitor. Show all posts

Wednesday, October 09, 2013

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