3

Accordingly to http://developer.android.com/google/play/expansion-files.html,

The main activity in your application (the one started by your launcher icon) is responsible for verifying whether the expansion files are already on the device and initiating the download if they are not.

And they really check existance of OBB in onCreate method of main activity.

I wonder how do I handle situation when OBB is present at application launch, but afterwards, during gameplay, user erases it and returns to the app. And do I need to take care at all?

Nick
  • 3,205
  • 9
  • 57
  • 108
  • 1
    You can always check to see if the OBB is still there every time you access its content, but if your app uses resource in the OBB a lot, it's probably very hard to make such an event non-catastrophic. Is this something your user has experienced? Most users don't just decide to open a file browser and start deleting directories he doesn't understand out of the blue. – Kai Jul 06 '13 at 02:25

2 Answers2

0

I've only started with android development, but ...

You should be able to implement a http://developer.android.com/reference/android/os/FileObserver.html to watch for deletion or movement.

However as Kai stated, most people don't delete things they don't know about. So I wouldn't worry about it.

user694844
  • 1,188
  • 11
  • 16
0

This might be as simple as checking if the file exists, you could easily do a File mFile = new File(pathToFile); then do a check if (!f.Exists()) { //do something }. You could do this every time content is accessed.

Another option is to use getSystemService(STORAGE_SERVICE); and pass commands to see if the OBB is mounted or not. StorageManager android

MrPancake
  • 84
  • 4