jeudi 16 juin 2016

InvocationTargetException and SecurityException

I've got following method:

private void callRef(BluetoothDevice device) {
      try {
         Method method = device.getClass().getMethod("createBond", (Class[]) null);
         method.invoke(device, (Object[]) null);
      } catch (Exception e) {
         Timber.e(e, "while callRef");
      }
   }

And i've got following problem:

java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)

Caused by: java.lang.SecurityException: Permission Denial: broadcast from android asks to run as user -1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS

What could cause this problems? Exceptions are not thrown everytime.





Aucun commentaire:

Enregistrer un commentaire