BluetoothHDPService.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:buildAPKsSamples 作者:
/**
 * Make sure Bluetooth and health profile are available on the Android device.  Stop service
 * if they are not available.
 */
@Override
public void onCreate() {
    super.onCreate();
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
        // Bluetooth adapter isn't available.  The client of the service is supposed to
        // verify that it is available and activate before invoking this service.
        stopSelf();
        return;
    }
    if (!mBluetoothAdapter.getProfileProxy(this, mBluetoothServiceListener,
            BluetoothProfile.HEALTH)) {
        Toast.makeText(this, R.string.bluetooth_health_profile_not_available,
                Toast.LENGTH_LONG);
        stopSelf();
        return;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号