Open ak1987 opened 3 years ago
I didn't found appDeviceId getter method. I've never worked with Java language, so don't blame code quality. My workaround was:
private void handleGetDeviceId(MethodCall call, Result result) { try { System.out.println("Getting DeviceID"); final String[] deviceId = new String[1]; AppMetricaDeviceIDListener listener = new AppMetricaDeviceIDListener() { @Override public void onLoaded(@Nullable String s) { deviceId[0] = s; System.out.println("s loaded: " + s); System.out.println("deviceId[0] set: " + deviceId[0]); } @Override public void onError(@NonNull AppMetricaDeviceIDListener.Reason reason) { System.out.println("DeviceID loading error"); } }; YandexMetrica.requestAppMetricaDeviceID(listener); TimeUnit.SECONDS.sleep(1); System.out.println("deviceId[0] loaded: " + deviceId[0]); result.success(deviceId[0]); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); result.error("Error getting Device ID", e.getMessage(), null); } }
It worked. Please fell free to take it as a starting point.
I didn't found appDeviceId getter method. I've never worked with Java language, so don't blame code quality. My workaround was:
It worked. Please fell free to take it as a starting point.