Android Question javascript interface changes?

drgottjr

Expert
Licensed User
Longtime User
warning: vaguely described problem follows

did the javascript interface in webviewextras stop working at some point? or perhaps it works in a different way now?

i don't know whether it's to do with android, b4a, the api level, the emulator or global warming, but my app, which for years relied on a conversation between a webview and B4A through webviewextras javascript interface no longer has that conversation. looking for guidance, i stumbled onto the forum thread dealing with webviewextras, webviewextras2, ajwebkit... i've read many pages worth of that
interesting exchange, and my head is spinning.

the app has run unmodified on nexus galaxy, nexus 4 (upgraded by google along the way to android 5.1), moto e (5.1 out of the box), and several cheap tablets running 4.x. i have not had to rebuild it since the days of B4A 4.x. the relevant library then was webviewextras 1.30.

recently i had to update a key to access a server. i'm now running B4A 5.50. i loaded the source, edited the key and rebuilt and ran it on the emulator. none of the B4A subs that are called by the webview were called. no errors in the log. i updated the webviewextras library to 1.42. same story.

so i cobbled a little test together and ran it on the emulator. the webview apparently made no calls to B4A. i put it on my moto e (which runs the old full-blown app just fine). again, nothing. since the test pretty much just reflects code which used to work but apparently no longer works, i'm not surprised that it, too, fails. in any case, i'm including it. i don't know exactly what's acceptable or useful to upload, so i'm sending the apk and a zip archive of the source alone. any help is appreciated.

-go

ps - at the risk of repetition, the javascript interface works perfectly on all my devices running the unmodified app. i can only assume b4a 5.5 is looking for something i'm not feeding it. i haven't tried re-installing a version from the 4.x family of fine ide's.
 

Attachments

  • Ubi.apk
    143 KB · Views: 266
  • Ubi.zip
    1.3 KB · Views: 234

drgottjr

Expert
Licensed User
Longtime User
does release (obfuscated) count?
anyway, when i change from obfuscated to fuscated, it works. thanks. a lot! but, hold on. something is not making sense to me. the test was in obfuscated mode because it was the app with 99% of the basic code cut out. and the app was in obfuscated mode due to the access keys it contains. in other words, it was already in obfuscated mode, and it's been that way since i first learned that obfuscated mode was offered to scramble things like access keys. and it ran perfectly on the emulator and on the devices it was deployed to.

but something just hit me: my new b4a key. i seem to recall something about obfuscation being based on my key? is
that what's going on? obviously, obfuscation is not needed for the test, but it is necessary for the app. what do i need
to legalize obfuscation again?
-go
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
ok, so i see if i include an underscore in the name of any subs called by javascript, obfuscated mode works. i'm guessing that's the solution, although i am confused as to why the app never failed before, as the ide was already in obfuscated mode and there were no underscores in any of the subs called by javascript. but then i'm usually confused.
 
Upvote 0
Top