airsdk / ANE-PlayAssetDelivery

Play Asset Delivery ANE
2 stars 2 forks source link

how to use getAssetAbsolutePath #5

Closed jimmymjing closed 2 years ago

jimmymjing commented 2 years ago

Hello, I couldn't figure out how to use getAssetAbsolutePath to get the absolute path for a directory. The params are a1 and a2. I tried a1 as the asset pack's ID and a2 as the relative folder's path but got null return value. (It works if this is a file)

I know that I could simply get the location of the Asset Pack and then do a string concat. But I'm actually trying to use it to determine if a folder exists in a Asset Pack.

ajwfrost commented 2 years ago

I think this is really just the same as concatenation, but it additionally checks that the asset pack has been loaded. This call is only valid for fast-follow and on-demand asset packs, and if they're not yet downloaded then the result would be 'null'..

Note too that if they're fast-follow asset packs and you're testing these, then you do actually need to request them manually (unlike when the app is installed from the Play Store): https://developer.android.com/guide/playcore/asset-delivery/test

So before you use getAssetAbsolutePath, please check the status of the asset pack, and best to wait for a completed signal...

jimmymjing commented 2 years ago

Thanks so much for clarifying this! Now everything works.