refresh Device Cache - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth

Description

refresh Device Cache

Demo Code

import java.lang.reflect.Method;

import android.annotation.TargetApi;
import android.bluetooth.BluetoothGatt;
import android.os.Build;

public class Main {

  @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
  static boolean refreshDeviceCache(BluetoothGatt gatt) {
    try {//from  w w  w.ja  v  a 2  s  . c om
      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