heremaps / here-android-sdk-examples

Java-based projects using the HERE SDK for Android.
Apache License 2.0
145 stars 191 forks source link

MapEngine.getInstance().init causes DiskReadViolation #363

Open samvmisti opened 4 years ago

samvmisti commented 4 years ago

@starand , @NazarKacharaba

After MapEngine.getInstance().init() was called, every time I've got DiskReadViolation. Delays can be between 1400 ms and 1500 ms. Checked with StrictMode. How can I speed up your Here Analytics?

D/StrictMode: StrictMode policy violation; ~duration=1467 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1504)
        at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:251)
        at java.io.File.exists(File.java:815)
        at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:605)
        at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:596)
        at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:552)
        at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:747)
        at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:400)
        at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:174)
        at com.here.sdk.hacwrapper.HacUtils.fetchLegacyIds(HacUtils.java:1)
        at com.here.sdk.hacwrapper.HacAnalytics.initialize(HacAnalytics.java:5)
        at com.nokia.maps.s.a(AnalyticsTrackerExternal.java:47)
        at com.nokia.maps.n.a(Analytics.java:7)
        at com.nokia.maps.MapsEngine$r.a(MapsEngine.java:260)
        at com.nokia.maps.MapsEngine$r.onPostExecute(MapsEngine.java:1)
        at android.os.AsyncTask.finish(AsyncTask.java:695)
        at android.os.AsyncTask.access$600(AsyncTask.java:180)
        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

And

D/StrictMode: StrictMode policy violation; ~duration=1442 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1504)
        at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:251)
        at java.io.File.exists(File.java:815)
        at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:605)
        at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:596)
        at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:552)
        at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:747)
        at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:400)
        at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:174)
        at com.here.sdk.analytics.internal.KeyValueStorageImpl.<init>(KeyValueStorageImpl.java:2)
        at com.here.sdk.analytics.internal.AndroidPlatformCallsImpl.keyValueStorage(AndroidPlatformCallsImpl.java:2)
        at com.here.sdk.analytics.internal.Analytics.create(Native Method)
        at com.here.sdk.analytics.HEREAnalytics.<init>(HEREAnalytics.java:43)
        at com.here.sdk.analytics.HEREAnalytics.setup(HEREAnalytics.java:2)
        at com.here.sdk.hacwrapper.HacAnalytics.initialize(HacAnalytics.java:17)
        at com.nokia.maps.s.a(AnalyticsTrackerExternal.java:47)
        at com.nokia.maps.n.a(Analytics.java:7)
        at com.nokia.maps.MapsEngine$r.a(MapsEngine.java:260)
        at com.nokia.maps.MapsEngine$r.onPostExecute(MapsEngine.java:1)
        at android.os.AsyncTask.finish(AsyncTask.java:695)
        at android.os.AsyncTask.access$600(AsyncTask.java:180)
        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
NazarKacharaba commented 4 years ago

Hi @samvgorode Thanks for reporting this. We will take a look into this. Meanwhile, you can contact your HERE representatives to find out whether you can disable analytics in the HERE SDK.