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: 15
Registered: ‎07-23-2013
My Device: BB 10
My Carrier: Virgin

Porting Android phonegap app to BB 10

Hi:

I am porting Android hybrid (native + phonegap) app to BB 10 using Eclipse plug-in and seems to be having a hard time with figuring out what libraries I need. In my Android project I am using:

- cordova 2.5.0

- jQuery version 1.8.2

- jquery-mobile-1.2.0.min.js

 

When I converted Android app and tried to run it on BB 10 Simulator - the app was build and installed, but clicking on "href" (a) links gave me "Error Loading Page" error message (I have multiple HTML pages in my app). I tried using libraries I found on GitHub (http://blackberry.github.io/jQueryMobile-BB10-Theme/), but jQuery was not loading properly (I was getting error that variable "$" cannot be found).

 

Another app (that is using jquery mobile 1.3.0, but no phonegap) was converted and run without any problems. (I tried using jquery mobile 1.3.0 in phonegap app - but was getting the same error).

 

Any help will be greatly appreciated,

Olga

Contributor
Posts: 15
Registered: ‎07-23-2013
My Device: BB 10
My Carrier: Virgin

Re: Porting Android phonegap app to BB 10

[ Edited ]

Progress report:

I was able to link Blackberry library from GitHub, but still getting "Error Loading Page" error when clicking on links and my page layouts were messed-up, so I went back to the original versions of jquery and jquery mobile. After some more debugging, I think I located the possible issue:  

- my HTML pages are located in the folder "assets/www", so when I want to acess "page2.html" from "page1.html" using relative link,  dataUrl in the jquery mobile file should be "page2.html", but instead it is "/android_asset/www/page2.html". I tried to replace  "/android_asset/www/" with empty string (using replace function in jquery mobile js file), but it didn't work (probably it set up somewhere else).

 

Any help will be appreciated, 

Olga

Contributor
Posts: 15
Registered: ‎07-23-2013
My Device: BB 10
My Carrier: Virgin

Re: Porting Android phonegap app to BB 10

[ Edited ]

I figured out that it fails in $ajax function in jquery mobile. In files that do not have jquery links are working fine.

Also LogCat gives me a warning that it can not find WebView<Init> function that referenced in Cordova library.

 

Olga

 

Update:

I sort of figured out the link issue - adding attribute "target='_self'" to a tag solved loading next page issue.

 

Also I concluded that adding "href" and "onclick" to "a" tag at the same time does not work.  The "click" even should be added through "jQuery(document).ready(function($)...    $("#mytag").click(function(){ .... code here ....;});" 

 

Compare to Android and iOS implementation  for multi-page phonegap app - the variables set in separate javascript file do not saved across pages - they have to be saved and read from local storage. 

 

I feel a bit better now - will post more when progress with conversion.

 

Olga

Contributor
Posts: 15
Registered: ‎07-23-2013
My Device: BB 10
My Carrier: Virgin

Re: Porting Android phonegap app to BB 10

Progress report:

I ended up combining all HTML in one file - this allows me avoid cashing data. Only thing that is not working on Simulator yet is dynamically created text input box  - for some reason clicking with mouse inside the box is closing application. I hope that this is only Simulator's problem. On Monday I will test the app on the actual Blackberry device, and then will know more.  Also I tried using Web Inspector in Chrome, but could not connect it to the app (used Simulator IP address and port 1337 as per documentation).

 

Good luck to all who is porting Android phonegap to BB 10, it is not that bad after all.

 

Olga

New Member
Posts: 2
Registered: ‎11-02-2013
My Device: bold
My Carrier: djezzy

Re: Porting Android phonegap app to BB 10

convert  any apk file to bar file with this application

 

 

http://www.mediafire.com/download/zm6mo7sk28ovswy/ApkToBar.rar