Software Archive
Read-only legacy content
17061 Discussions

Plugin intel.xdk.cache: Index starts with 0 after restarting app

Ad
New Contributor III
340 Views

Maybe this it not the correct place, but I have discovered a bug in android code of the Intel XDK Cache plugin (intel.xdk.cache), and solved it too!
I have already posted it on the Intel XDK Cache GitHub project page, but I share it here too, to share the problem.

We are developing an Android App where users can store different images locally. We are using the MediaCache for storing the files on the device.

Files can be added to the cache by using the methods AddMediaCache or AddMediaCacheExt, the index is than incremented every time a file is added. So far so good. But if I kill the App and restart the App again, the index starts from 0 again and the old stored indexed files are overwritten by the new cached files!

After reviewing the Android code for the methods "AddMediaCache" and ""AddMediaCacheExt" I discover that in the private function "getFilenameWithURL", the code

newFile = new File(newFileName)

is using the wrong caching directory, or better: no path at all.
After adding the path "cachedMediaDirectory" to the File function,

newFile = new File(cachedMediaDirectory, newFileName) 

the index is calculated correctly and new cached files are getting the right index number, even after restarting the App.

I don't know if the iOS and Windows platforms are also effected by this problem (at this time I can only test/debug Android Apps), but it's likely that

Maybe this issue is solved in the new release of the plugin, if not take your advantaged of this post!

0 Kudos
1 Reply
Swati_S_Intel1
Employee
340 Views

Thanks for sharing!

0 Kudos
Reply