Start a new topic
Solved

.js files not loaded in app's first run

Hi,


I have done an Android app using Wikitude 7.1.0, Javascript API. When I install the app on my phone, the target image doesn't get recognized on first run. If I close the app and re-launch it, it works perfectly.


I assume the .js files are not loaded on first run. Please help.


js
(1.18 KB)
js
(2.91 KB)

I tried replacing my code with '01_ImageTracking_1_ImageOnTarget' sample in the assets folder. On the first run it displays 'Loading ...' and nothing else. On closing the app and launching it again it works fine.


Please help

 Hello Ashwin,


So when you tested our sample exactly as we provide it without any changes, you were getting the same experience? If so, could you please send over your AR experience (.html, .css, .js files, assets, target images) so we can test internally? Also, please provide details of the phone you are testing with.


Thanks

Eva

The problem was not in JS but in the Java code.


Since my phone has Android 7, the camera permission had to be granted at runtime. I did the requestPermission, but had not called the listener to check if the permission was granted. 

So when the runtime permission dialog box popped up, the onPostCreate() was called and  architectView was loaded. (without accepting or denying the permission)


Using onRequestPermissionResult(), I made sure that camera permission was granted before calling architectView.onCreate(config) or architectView.load( "url"). 


Now everything is fine.


Thank you





Login or Signup to post a comment