We know that developing android apps and working with AdColony SDK to show video ads gives you problem. The problem we found usually it keeps downloading video ads and save them on the device.
I found the comment from the person from Adcolony, He says
AdColony does cache our assets to the device - both for quality (instant loading advertisements) as well as reusability. Many assets are shared across multiple campaigns and in the case that a duplicate advertisement is served it saves you from re-downloading the same assets.
Each device has a specific memory class (or app specific memory limit) that we will not exceed, and we also purge old and unused assets occasionally to keep the size down.
While it is possible to programmatically clear your app's data cache, we do not recommend this as it may lead to redundant downloads and unnecessary data usage.
Please feel free to contact us further at support@adcolony.com.
Solution:
Your video is stored in the application data path.
You just have to delete file created with the File.Delete() command.
This code will do the trick and works on PC, Mac, iOS and Android:
string fileName = ""; #if UNITY_IPHONE string fileNameBase = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/')); fileName = fileNameBase.Substring(0, fileNameBase.LastIndexOf('/')) + "/Documents/" + FILE_NAME; #elif UNITY_ANDROID fileName = Application.persistentDataPath + "/" + FILE_NAME ; #else fileName = Application.dataPath + "/" + FILE_NAME; #endif fileWriter = File.CreateText(fileName); fileWriter.WriteLine("Hello world"); fileWriter.Close();
[edit]
Since Unity 3.3, it is no longer necessary to use platform-specific code for simple file I/O. Use Application.persistentDataPath to do the trick.
This code would replace the code above:
string fileName = Application.persistentDataPath + "/" + FILE_NAME; fileWriter = File.CreateText(fileName); fileWriter.WriteLine("Hello world"); fileWriter.Close();
Thanks, erique, for pointing this out on the Unity forum.
[/edit]
source:previewlabs
Comments
Post a Comment