airsdk / ANE-PlayAssetDelivery

Play Asset Delivery ANE
2 stars 2 forks source link

program stopped execution when calling getAssetPackStatus/getTotalBytesToDownLoad/getByteDownloaded #3

Closed jimmymjing closed 2 years ago

jimmymjing commented 2 years ago

@marchbold @ajwfrost Hello, I'm debugging the aab with Asset Delivery and find that my program stops when I call any functions on the PlayAssetDelivery instance. (getAssetPackStatus, getTotalBytesToDownLoad...). Here's the code:

var _pad:PlayAssetDelivery = new PlayAssetDelivery();
var _isPADInited:Boolean = _pad.initAssetDelivery();
if (_isPADInited) {
    // PlayAssetDelivery initialised
    trace("PlayAssetDelivery initialised"); // no problem to reach here
    _pad.addEventListener(PlayAssetDeliveryEvent.PLAY_ASSET_UPDATE, playAssetDelivery_statusHandler)
    trace("getAssetPackStatus: " + _pad.getAssetPackStatus("ap_assets_one")); 
    _pad.fetchAssetPack("ap_assets_one"); // <-------NEVER GET EXECUTED
    trace("getTotalBytesToDownLoad: " + _pad.getTotalBytesToDownLoad("ap_assets_one"));
    trace("getByteDownloaded: " + _pad.getByteDownloaded("ap_assets_one"));
    trace("getTransferProgressPercentage: " + _pad.getTransferProgressPercentage("ap_assets_one"));
}

(FYI)

  1. I also tried to call fetchAssetPack first, and it also stops my program.
  2. I checked the aab package in Android Studio and I could see the ap_assets_one package.
  3. I use logcat with filter distriqt|AndroidRuntime|System.err, and I'm not seeing any error outputs. Screen Shot 2021-12-22 at 2 44 05 PM Screen Shot 2021-12-22 at 2 45 11 PM

Thanks in advance!

ajwfrost commented 2 years ago

I'm not sure whether it's possible to do debugging with an asset pack that's not "install-time" .. it's most likely hanging because it's trying to get the asset pack status from the play services and if you're local-debugging, this won't be present. We can probably change this to detect the issue and return control to ActionScript but I don't think you'll ever find the status of 'completed' for this..

jimmymjing commented 2 years ago

Hi, I find that we need to add local-testing -- java -jar bundletool-all.jar build-apks --bundle=path/to/your/bundle.aab \ --output=output.apks --local-testing. This param is not available with adt -installApp.

ajwfrost commented 2 years ago

Hi @jimmymjing - just to check, when you manually create the APKs file like this, then it works again? I'm wondering whether we should update the installation of AAB files to always use the local-testing option, I'm not sure there's any adverse affects for people who don't want to use this..

jimmymjing commented 2 years ago

Hi, with this Param set, I'm able to do local testing for the debug version aab with PAD. Maybe we could add it also as a param for adb?

ajwfrost commented 2 years ago

Yes I think it looks like it's best for us to just always enable this .. will update the bundletool jar as well of course.. thanks