Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development

Reply
Contributor
Posts: 31
Registered: ‎01-10-2013
My Device: BB10 alpha dev simulator
My Carrier: ATT

Porting google map view to web view

[ Edited ]

greets folks,

so i'm trying to replace my google map view with a web view that loads a web page with a google web map.

 

wondering if anyone's had success doing this and getting it working with bb10.

 

i've replaced a good deal of my map activity finctionaltiy using a javascript app in a web view.

 

right now i'm loading the web page from the assets folder of the andorid app.

 

this might be silly question, but,

can i leave the app loading the web page file from the assets folder or will i need to host the page on a server somewhere and load it from there?

 

does anyone have info on how the assets folder is compiled into an APK and if it'll be accessible when converted to a BAR and running in android runtime on BB10?

Regular Contributor
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!
My Carrier: 8608800458

Re: Porting google map view to web view

I also ported by switching over to a web view and the javascript maps api. So no real problems there. As for loading the page, I went with the option of hosting it on an external server (although there is some caching behavior at work as well).

 

Can't say much about the assets folder. Have you tried testing on any of the simulators? If it works on the simulator then you should be good to go. I would imagine it will be fine.

Contributor
Posts: 31
Registered: ‎01-10-2013
My Device: BB10 alpha dev simulator
My Carrier: ATT

Re: Porting google map view to web view

cool, thanks for the insight.
i'm just going to go ahead and update my droid app to point to an open html file on my companies server. then create the APK. then do the bb10 convert. then try to install on my bb10 sim and see what happens.
Contributor
Posts: 31
Registered: ‎01-10-2013
My Device: BB10 alpha dev simulator
My Carrier: ATT

Re: Porting google map view to web view

[ Edited ]

Okay, I have an issue.

 

I just built my APK having hosted my html map view web page on our server.

I updated my code to point to that html file. Which has a map and some javascript to drive the android app.

 

In debug through eclipse, it works. Map loads. Everything fucntions.

 

Once I build the APK and install it on my droid phone, the map doesn't load.

I am loading an Https web page under a secured web page that requires authentication but i have updated the web config to not require a login to access this particular page.

 

 

any tips, help?

Highlighted
Regular Contributor
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!
My Carrier: 8608800458

Re: Porting google map view to web view

@towps: hmm, not sure.  So your webpage is reachable from a browser, and you've tested that right? Can you reach that page from our phone? 

 

Also, I assume you are using the standard Android build here and not Signing for Blackberry and then extracting the APK from that for your droid phone right? 

 

If you just run it from Eclipse onto your phone (Run As->Android Application) does it work? If you then Export as Signed Android Application and use adb install, then it doesn't work??

 

Keep in mind of course for blackberry you would go through the Blackberry build process but sounds like maybe you are trying to have one set of code for BB and standard Android.

Contributor
Posts: 31
Registered: ‎01-10-2013
My Device: BB10 alpha dev simulator
My Carrier: ATT

Re: Porting google map view to web view

hey, thanks for the reply.

so yeah, i am just making sure my app works as an android app before trying to convert the APK to a BAR.

At least that's my understanding of the process, that I would submit the APK to the BB20 online convert tool and get a BAR back. Maybe I need to do a blackberry APK build in eclipse?

 

Anyway I need to make sure my app works as an android app first I think.

 

so basically i found out that i may need an API key for the google javascript api. 

So I got one and added the key to my map api import script and using https since my page will be hosted in an SSL website. <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=mykey&sensor=true"></script> 

 

So I navigate to my external page in firefox and chorme and the page loads and the map functions.

 

So just now, I'm running as an android app from eclipse onto my galaxy nexus phone and the map loads and functions with my android code.

 

Once I export as signed APK, i copy the exported APK to my android harddrive and install it from the device by selecting the APK from a file manager tool. The app installs and the map stays blank, white. I don't get it.

Contributor
Posts: 31
Registered: ‎01-10-2013
My Device: BB10 alpha dev simulator
My Carrier: ATT

Re: Porting google map view to web view

oh shoot, you're first question there is a good one. I should try to hit the page with the phone browser, not just my app. word

Contributor
Posts: 31
Registered: ‎01-10-2013
My Device: BB10 alpha dev simulator
My Carrier: ATT

Re: Porting google map view to web view

[ Edited ]

yeah the page loads in firefox on my phone! good grief....

 

i also tried setting my root home page as the web url in my app.

So where my web map sits is something like https://mysite.com/mysiteapp/mymapapp/default.html, 

 

If I set the URL to  https://mysite.com/mysiteapp, the web view loads the page properly for that applicaiton and functions as expected. i'm missing something... 

Regular Contributor
Posts: 84
Registered: ‎01-31-2013
My Device: Simulator !!!
My Carrier: 8608800458

Re: Porting google map view to web view

Can you check your webserver to see if the page is getting called from the app? Maybe it gets loaded and a javascript error occurs. My guess is that the page is loaded but google maps isn't displaying.

Saw one similar question on stackoverflow but no difinite resolution although they made a comment about the sensor parameter, but looks like you have that. Also you may want to include a v= parameter. http://stackoverflow.com/questions/15142027/web-view-not-loading-page-after-exporting-to-signed-apk
Contributor
Posts: 31
Registered: ‎01-10-2013
My Device: BB10 alpha dev simulator
My Carrier: ATT

Re: Porting google map view to web view

hah yeah that's my question! i need this answer asap lol