refresh Bluetooth Device Cache - Android Bluetooth

Android examples for Bluetooth:Bluetooth Device

Description

refresh Bluetooth Device Cache

Demo Code

/*/*from   www . ja v  a 2s  .  c  o  m*/
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * version 3 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * Please contact Integreight, Inc. at info@integreight.com or post on our
 * support forums www.1sheeld.com/forum if you need additional information
 * or have any questions.
 */
//package com.java2s;
import android.annotation.TargetApi;

import android.bluetooth.BluetoothGatt;

import android.os.Build;
import java.lang.reflect.Method;

public class Main {
    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
    static boolean refreshDeviceCache(BluetoothGatt gatt) {
        try {
            Method localMethod = gatt.getClass().getMethod("refresh",
                    new Class[0]);
            if (localMethod != null) {
                return (boolean) (Boolean) localMethod.invoke(gatt,
                        new Object[0]);
            }
        } catch (Exception ignored) {
        }
        return false;
    }
}

Related Tutorials