agamemnus / cordova-plugin-xapkreader

Easily access Google Play APK expansion file data.
32 stars 55 forks source link

XAPKReader.downloadExpansionIfAvailable() makes status bar disappear #117

Open MajorBreakfast opened 6 years ago

MajorBreakfast commented 6 years ago

In order to make the splash screen show up I'm following the instructions in the README and use XAPKReader.downloadExpansionIfAvailable() to download the expansion files after the splash screen isn't visible anymore. Unfortunately calling this function has a side effect: The status bar slides up and is thus gone. As a workaround I've added StatusBar.show() to the callbacks of downloadExpansionIfAvailable(). Works perfectly, but it's a hack nonetheless :D

MajorBreakfast commented 6 years ago

More details about my workaround: Calling StatusBar.show() synchronously in the callbacks of downloadExpansionIfAvailable() didn't work. I now call it repeatedly via this monstrosity: callRepeatedly(() => StatusBar.show(), 2000) Works, but it's not pretty

function callRepeatedly (fn, duration) {
  let id
  function tick () { fn(); id = setTimeout(tick, 1) }
  tick()
  setTimeout(() => { clearTimeout(id) }, duration)
}
agamemnus commented 6 years ago

Thank you. I'll look into all this.

On Jan 9, 2018 8:29 AM, "Josef Brandl" notifications@github.com wrote:

More details for my workaround: Calling StatusBar.show() synchronously in the callbacks of downloadExpansionIfAvailable() didn't work. I now call it repeatedly via this monstrosity: callRepeatedly(() => StatusBar.show(), 2000) Works, but it's not pretty

function callRepeatedly (fn, duration) { let id function tick () { fn() id = setTimeout(tick, 1) }

tick()

setTimeout(() => { clearTimeout(id) }, duration) }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/117#issuecomment-356283779, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWO7pDA-1Ai4goABFDpC36b5vhDfgks5tI2mpgaJpZM4RXx1n .

pedrojosecas commented 5 years ago

Hi agamemnus,

I'm try to use your plugin with Cordova 8.0.0, but when build and run my project, crash complete.

Can you help me? I download from the branch cordova-6.5.0.

Thanks.

agamemnus commented 5 years ago

8!

I can't keep up with all the changes unfortunately. Someone has to keep submitting PRs.

On Mon, Aug 6, 2018, 3:19 PM pedrojosecas notifications@github.com wrote:

Hi agamemnus,

I'm try to use your plugin with Cordova 8.0.0, but when build and run my project, crash complete.

Can you help me? I download from the branch cordova-6.5.0.

Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/117#issuecomment-410822915, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWHrmjZGIDAMqSi1Ms0hqmzp3YgTPks5uOJa9gaJpZM4RXx1n .

agamemnus commented 5 years ago

Try to find out what the error is.. We can try to go from there.

On Mon, Aug 6, 2018, 3:19 PM pedrojosecas notifications@github.com wrote:

Hi agamemnus,

I'm try to use your plugin with Cordova 8.0.0, but when build and run my project, crash complete.

Can you help me? I download from the branch cordova-6.5.0.

Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/117#issuecomment-410822915, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWHrmjZGIDAMqSi1Ms0hqmzp3YgTPks5uOJa9gaJpZM4RXx1n .

pedrojosecas commented 5 years ago

I found how some the issues but when make cordova run android appear this error and the app crash and close, you know why or give me some idea to solve:

08-06 13:52:08.017 1184-1184/com.mathshelf.mathshelf D/AndroidRuntime: Shutting down VM

--------- beginning of crash

08-06 13:52:08.018 1184-1184/com.mathshelf.mathshelf E/AndroidRuntime: FATAL EXCEPTION: main Process: com.mathshelf.mathshelf, PID: 1184 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mathshelf.mathshelf/com.mathshelf.mathshelf.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2730) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2795) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1530) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:208) at android.app.ActivityThread.main(ActivityThread.java:6304) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190) at android.content.res.Resources.getInteger(Resources.java:1198) at com.flyingsoftgames.xapkreader.XAPKReader.initialize(XAPKReader.java:71) at org.apache.cordova.CordovaPlugin.privateInitialize(CordovaPlugin.java:57) at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:171) at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:97) at org.apache.cordova.PluginManager.init(PluginManager.java:86) at org.apache.cordova.CordovaWebViewImpl.init(CordovaWebViewImpl.java:117) at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:149) at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:224) at com.mathshelf.mathshelf.MainActivity.onCreate(MainActivity.java:50) at android.app.Activity.performCreate(Activity.java:6704) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2683) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2795)  at android.app.ActivityThread.-wrap12(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1530)  at android.os.Handler.dispatchMessage(Handler.java:110)  at android.os.Looper.loop(Looper.java:208)  at android.app.ActivityThread.main(ActivityThread.java:6304)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) 

agamemnus commented 5 years ago

This is weird. I'm not an expert on this. Can't tell. Can you try making a blank app and just add things in until it crashes?

pedrojosecas commented 5 years ago

I created a blank project and the same issue :(

when open the app crash and appear the same issue, I only download your project add the plugin to the blank project, make the configuration and then cordova run android, but crash :(

agamemnus commented 5 years ago

Can't tell anything from the bug report.. you can try to use a lower version or download things on the fly.

pedrojosecas commented 5 years ago

Hi Agamemnus,

I have a one question, is a dumb question, but I need ask you, I have the obb file in the folder but when I try to access like this:

< img src="content://com.companyname.myapp/src/image1.jpg">

I can't, in the obb file I have the sources in the folder src. And other question, the obb is unzip or only need access to the obb without unzip?

Thanks.

agamemnus commented 5 years ago

The directory structure refers to the structure in your zip file. And it can't be compressed, but it must be a zip file of type "store".

On Thu, Aug 9, 2018, 11:26 AM pedrojosecas notifications@github.com wrote:

Hi Agamemnus,

I have a one question, is a dumb question, but I need ask you, I have the obb file in the folder but when I try to access like this:

< img src="content://com.companyname.myapp/src/image1.jpg">

I can't, in the obb file I have the sources in the folder src. And other question, the obb is unzip or only need access to the obb without unzip?

Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/117#issuecomment-411797638, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWFEfEL-981UbybEdZx5SLd_HonrOks5uPFS9gaJpZM4RXx1n .

pedrojosecas commented 5 years ago

Thanks,

Yes the structure is same in my zip and try to load the source, but I can't access, say File not Found, the only way I can access is when I unzip the obb.

agamemnus commented 5 years ago

What parameters did you use when you set up the plugin?

On Thu, Aug 9, 2018, 1:41 PM pedrojosecas notifications@github.com wrote:

Thanks,

Yes the structure is same in my zip and try to load the source, but I can't access, say File not Found, the only way I can access is when I unzip the obb.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/117#issuecomment-411839261, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWMApDegQw-9LaUtzCn4EXtRJomuDks5uPHRZgaJpZM4RXx1n .