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™ Runtime Development

Reply
Developer
kamal_nigam
Posts: 434
Registered: ‎07-23-2012
My Carrier: Orange

XMLHttpRequest Exception 101:: APK to BAR file Conversion

[ Edited ]

We have developed html5 application. For BB10 we are converting the APK into bar file. When we are running the application on BB10 device it is throwing the “"Network_error : XMLHttpRequest Exception 101" error inside the  “jquery.i18n.properties-1.0.9.js” file. Same code working on the Android device. We have tried “async: true” inside Ajax call but unable to resolve. Any help ??

 

Note: file we are reading is part of application not any server

Thanks
-------------------------------------------------------------------------------------
Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
-------------------------------------------------------------------------------------.
Please use plain text.
Developer
ndsmyter
Posts: 642
Registered: ‎09-26-2012
My Carrier: Mobile Vikings

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

Just a quick question, why didn't you use the HTML5 development style for BB10? Because now you have a HTML5 app, packaged as an Android app, which you are going to package as a BB10 app. While you could just package your HTML5 app as a BB10 app.

There is probably a reason why you choose to do this, do you mind sharing why?

More info: http://developer.blackberry.com/html5/


A like is always appreciated,
but a nomination for BB Elite even more :-)
You can also contact me on Twitter: @ndsmyter
Please use plain text.
Developer
kamal_nigam
Posts: 434
Registered: ‎07-23-2012
My Carrier: Orange

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

We already created the application for android devices. If we will use the webworks than  we might  face lots of issue?

Thanks
-------------------------------------------------------------------------------------
Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
-------------------------------------------------------------------------------------.
Please use plain text.
Contributor
joeljesudossj
Posts: 10
Registered: ‎02-15-2013
My Carrier: Reliance

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

Hi

 

I am also facing the same problem.

 

During ajax call

 

var ajax = new XMLHttpRequest();

try{

ajax.open('post',url, false);


alert(ajax);


ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
ajax.onreadystatechange = function() {


alert('onreadystatechange');


_oonreadystatechange(ajax);
}
var _oonreadystatechange = function(ajax) {


alert(ajax.readyState);

if (ajax.readyState == 4) {
if (ajax.status == 200) {


alert(ajax.responseText);


var resp=ajax.responseText.trim();
if(resp.charAt(resp.length-2) == ','){
resp = resp.substring(0,resp.length-2)+'}';

}

var dataarrey=JSON.parse(resp);

Ext.getStore('userInfostore').removeAll();
customerou= dataarrey.sm_userdn.split(',')[1].split('=')[1];

Ext.getStore('userInfostore').add({"mail":dataarrey.mail,"crmcompanyid":dataarrey.crmcompanyid,"uid":dataarrey.uid,"firstname":dataarrey.firstname,"lastname":dataarrey.lastname,"customertype":dataarrey.customertype,"ou":customerou});

}else {

alert(ajax.status+"Please Check Network Connection");
}
}
}
ajax.send(null);

}
catch (e) {
alert(e);
}

 

I am getting Error: NETWORK_ERR: XMLHttpRequest Exception 101

 

Have given alerts in the above code to debug as well,

 

in playbook alerts are comin in following order:

 

-[object XMLHttpRequest]

 

-onreadystatechange

 

-4

 

-0Please Check Network Connection

 

-Error: NETWORK_ERR: XMLHttpRequest Exception 101

 

 

Please suggest a solution.

 

Note:

 

We opted for the apk to bar conversion method, because we had a requirement to invoke playbook mail client with attachment, using playbook webworks sdk(since our existing code is in webworks ).

 

After exhaustively searching we found only the mailto option which has limitations of number of characters in message body and doesnt support attachment.

 

So finally after converting the apk android version of our app to bar, the bar was invoking the native mail client in playbook.

 

Now we ran into this ajax problem in the apk to bar converted executable, the apk is workin fine in android

 

Please give a solution 

 

Thanks

Regards

Joel

 

Please use plain text.
Developer
ndsmyter
Posts: 642
Registered: ‎09-26-2012
My Carrier: Mobile Vikings

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

@kamal_nigam It wouldn't introduce a lot more problems I guess. You will have to change some things to make sure the layout is correct for Webworks. But I guess that a lot of the actual code (not layout) can be kept as is. On top of that, your application will have a massive increase in speed. Because now you are using the HTML5 webview of Android, which runs inside the Android emulator, which runs on BlackBerry 10. If you are not willing to do some extra work for this speed bonus, you can still keep what you got. It should work as expected in both cases. At least if you are not having trouble with weird errors.

But I am afraid I cannot really help you in solving the problem.

 

@joeljesudossj I am afraid I cannot help you either. I don't really see why you are having this problem.

 

What I can recommend for both of you:

  • Really check your permissions if you have everything you need. I guess you will have checked that numerous times already. Maybe you could, to be very certain, just add all permissions there are available. If it still doesn't work, then it can't be because you are missing permissions.
  • As it is working on an Android device, it could maybe be a bug in the Android Emulator in the BlackBerry Simulator. Or have you checked on an actual BlackBerry device? If not, maybe you could try it on an actual device if you have one.

I have no more suggestions I can give you at this moment :/

 

Maybe somebody else can help you, and I hope 



A like is always appreciated,
but a nomination for BB Elite even more :-)
You can also contact me on Twitter: @ndsmyter
Please use plain text.
Contributor
joeljesudossj
Posts: 10
Registered: ‎02-15-2013
My Carrier: Reliance

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

Hi myter,
Thanks for your reply,I will try out what you said. So far everything I ran is on playbook device and not on simulator.

Also jsonp call is working fine on playbook device (used in existing project code) but I think jsonp is for "get", I need for "post".
I tried Ext.ajax and that is also not workin on playbook device, is there any way to use jsonp for post?

Thanks regards
Joel
Please use plain text.
Contributor
joeljesudossj
Posts: 10
Registered: ‎02-15-2013
My Carrier: Reliance

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

Hi is there a way to get the source code of hatax apk2bar. I tried googling but couldnt find the source code, there is only apk2bar.jar, Is there anyway to contact the developer of apk2bar.jar? If I can get hold of the API they are using to invoke the mail client with attachment, then i could probably use it directly in my webworks and generate a bar instead of building an apk and converting to bar.

 

This could be a useful workaround for me.

 

pls help

Regards Joel

Please use plain text.
Administrator
astanley
Posts: 1,359
Registered: ‎07-02-2009
My Carrier: Bell

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

kamal - I agree with your peers.  Would highly recommend porting your HTML5 application away from Android.  It may take some initial effort to re-package your assets using the WebWorks SDK (or PhoneGap) however you will be far happier in the long run.

 

The main reason why is because HTML5 applications running within the Android runtime are using the Android mobile web engine, not the one used by WebWorks and the BB10 browser.  See this comparison to understand what you are dealing with:

 

http://html5test.com/compare/browser/bb10/android23.html

 

Also, Android offers very few ways of integrating your HTML5 content with BlackBerry 10 device features.  Here is the complete list of developer APIs that you can use in WebWorks (none are available to your app while running inside of an Android container). Some highlights are Calendar, BBM, Payment : https://developer.blackberry.com/html5/apis/bb10_index.html

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Contributor
joeljesudossj
Posts: 10
Registered: ‎02-15-2013
My Carrier: Reliance

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

Hi Adam

 

Thanks for your reply, I went through the APIs for HTML5 in Playbook. 

 

But I need an api to invoke e-mail client with attachment. https://developer.blackberry.com/html5/apis/blackberry.invoke.card.html#.invokeEmailComposer

 

The supported OS for this api is given as BB10. I tried in playbook device (running 2.1)anyways and it didnt work, its not invokin the mail client.

 

I will try including <feature id="blackberry.invoke.card" /> , which I doubt will solve this problem.

 

Am I missing something ? Or is is blackberry.invoke.card.invokeEmailComposer api not supported in Playbook 2.1? Is there any other way to invoke mail client with attachment in playbook using webworks?

 

Thanks

Regards

Joel

 

 

Please use plain text.
New Contributor
aneveucertify
Posts: 3
Registered: ‎05-05-2013
My Carrier: NA

Re: XMLHttpRequest Exception 101:: APK to BAR file Conversion

We are facing the exact same problem. Has anyone found a solution to this yet?

Please use plain text.