Back to project page countly-sdk-android.
The source code is released under:
Copyright (c) 2012, 2013 Countly Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Soft...
If you think the Android project countly-sdk-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package ly.count.android.api; // www. ja v a2 s.com import android.content.Context; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class OpenUDIDAdapter { private final static String OPEN_UDID_MANAGER_CLASS_NAME = "org.OpenUDID.OpenUDID_manager"; public static boolean isOpenUDIDAvailable() { boolean openUDIDAvailable = false; try { Class.forName(OPEN_UDID_MANAGER_CLASS_NAME); openUDIDAvailable = true; } catch (ClassNotFoundException ignored) {} return openUDIDAvailable; } public static boolean isInitialized() { boolean initialized = false; try { final Class<?> cls = Class.forName(OPEN_UDID_MANAGER_CLASS_NAME); final Method isInitializedMethod = cls.getMethod("isInitialized", (Class[]) null); final Object result = isInitializedMethod.invoke(null, (Object[]) null); if (result instanceof Boolean) { initialized = (Boolean) result; } } catch (ClassNotFoundException ignored) {} catch (NoSuchMethodException ignored) {} catch (InvocationTargetException ignored) {} catch (IllegalAccessException ignored) {} return initialized; } public static void sync(final Context context) { try { final Class<?> cls = Class.forName(OPEN_UDID_MANAGER_CLASS_NAME); final Method syncMethod = cls.getMethod("sync", Context.class); syncMethod.invoke(null, context); } catch (ClassNotFoundException ignored) {} catch (NoSuchMethodException ignored) {} catch (InvocationTargetException ignored) {} catch (IllegalAccessException ignored) {} } public static String getOpenUDID() { String openUDID = null; try { final Class<?> cls = Class.forName(OPEN_UDID_MANAGER_CLASS_NAME); final Method getOpenUDIDMethod = cls.getMethod("getOpenUDID", (Class[]) null); final Object result = getOpenUDIDMethod.invoke(null, (Object[]) null); if (result instanceof String) { openUDID = (String) result; } } catch (ClassNotFoundException ignored) {} catch (NoSuchMethodException ignored) {} catch (InvocationTargetException ignored) {} catch (IllegalAccessException ignored) {} return openUDID; } }