diff --git a/CHANGELOG.md b/CHANGELOG.md index a769027c..a0174dee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +* Catch SecurityExceptions thrown during fetching of Google Advertising ID. This is caused by older versions of Google Play Services using `MODE_WORLD_READABLE` when reading from SharedPreferences. If you see this warning you should update your version of Google Play Services. + ## 2.18.1 (May 07, 2018) * Updating to [OkHttp 3.10.0](https://github.com/square/okhttp/blob/master/CHANGELOG.md#version-3100) diff --git a/src/com/amplitude/api/DeviceInfo.java b/src/com/amplitude/api/DeviceInfo.java index f9db52c5..2634d746 100644 --- a/src/com/amplitude/api/DeviceInfo.java +++ b/src/com/amplitude/api/DeviceInfo.java @@ -224,6 +224,8 @@ private String getAndCacheGoogleAdvertisingId() { AmplitudeLog.getLogger().w(TAG, "Google Play Services SDK not found!"); } catch (InvocationTargetException e) { AmplitudeLog.getLogger().w(TAG, "Google Play Services not available"); + } catch (SecurityException e) { + AmplitudeLog.getLogger().w(TAG, "Please update Google Play Services version"); } catch (Exception e) { AmplitudeLog.getLogger().e(TAG, "Encountered an error connecting to Google Play Services", e); }