HTC One network unreachable and another issues

130 views
Skip to first unread message

babtu

unread,
Feb 10, 2014, 10:08:07 AM2/10/14
to codenameone...@googlegroups.com
Today I did some tests of my app on HTC One with Android 4.3 installed. Unfortunately application doesn't see neither 3G nor WiFi Internet connection. During installation I gave it all privileges. On Android 4.3 emulator from Android SDK and Galaxy Trend with Android 4.0.3 everything is working fine. The second issue is that menu bar is appearing twice - on the Action bar (three dots) and at the bottom of the screen. In emulator and another devices everything is fine.  In project I have included a html file that contains link to google maps script. This html is loaded by Browser Component. I noticed, that in 4.4.2 emulator, that script is not loading just like connection was unavailable, but it is available (Connection Request works perfectly). Why all those things are happening?

Shai Almog

unread,
Feb 10, 2014, 1:00:36 PM2/10/14
to codenameone...@googlegroups.com
Are you building using our build server? Did you change build arguments?
The 3 dots at the bottom right appear when targeting older versions of Android.
The script might have an issue because of builtin protection google has for XSS bugs, it might not be possible to run a remote script like that.

babtu

unread,
Feb 11, 2014, 6:04:38 AM2/11/14
to codenameone...@googlegroups.com
Yes and no. But after your suggestion I changed min_sdk_version argument to 18 and 3 dots still appears (they look like that) . Application also can see network connection, but I'm getting an IO Exception: "No authentication challanges found for URL", when server responds with 401 code. The problem does not occur when I run application on a 4.3 emulator. I found out that there is a issue in Android that cause exception I mentioned (maybe it is not an issue at all, but we have not any influence on way that some servers are configured). Helpful links: http://stackoverflow.com/questions/17121213/java-io-ioexception-no-authentication-challenges-found#21534175 , http://stackoverflow.com/questions/14550131/http-basic-authentication-issue-on-android-jelly-bean-4-1-using-httpurlconnectio/14551482#14551482. I hope it could be fixed. I have embedded google maps in Browser Component following the example given by Steve Hannah "shannah" (many thanks to him, I find his solution the best mapping solution for CN1 so far). I wonder if he ever encountered that issue (webview embedded script loading problem on Android 4.4.2).

babtu

unread,
Feb 11, 2014, 10:07:40 AM2/11/14
to codenameone...@googlegroups.com
I performed some experiments and thats what I determined. HTC one does not have a menu soft key, maybe it have something to do with that three dots. Three dots menu at the bottom appears also on splash screen form. On Unfortunately I encountered another issue. FYI, form with Browser Component is generated from code. On HTC One device it appears c. a. every second form show() is called. When it is not showing, it appears on the screen for a very short time and closes. In logcat I can't see anything abnormal. When I add a Dialog.show() call in Form.onShow() method, then form is always showing properly. Just for testing purpose I created blank form in the GUI Builder and that form is showing every time it is called. Generally speaking, application on that device is pretty unstable on that device and is working incorrectly (for example I can't switch tabs by horizontal drag gesture). Another apps are working properly and whole device seems to be fine. What might be the cause of that behaviour?

Shai Almog

unread,
Feb 11, 2014, 12:16:40 PM2/11/14
to codenameone...@googlegroups.com
I don't quite understand the last few sentences can you please break this down to parts rather than a single block and provide clarifying details.

You shouldn't change the min-sdk value but the target sdk value to remove these android.targetSDKVersion=15 should probably solve that.

The basic security issue was mentioned in the forum before as far as I recall there was no workaround for this, its an issue with Android being overly strict. You might be able to use a proxy server to hide the actual server.

babtu

unread,
Feb 12, 2014, 10:45:31 AM2/12/14
to codenameone...@googlegroups.com
1. Changed android.min_sdk_version with no effect (3 dots at the bottom still present). I didn't changed target sdk parameter before because it is not present NetBeans (Project properties->CodenameOne category->Build hints tab) and it is not documented neither in the developers guide nor http://www.codenameone.com/advanced-build.html. After your suggestion I tried to set android.targetSDKVersion=15 with no effect. I also tried to set targetSDKVersion to random value to check whether it is correct argument name and app builded successfully. But If I change min_sdk_value to someting random I'm getting an build error, so I assume that paramter name you gave is wrong and it is ignored by build server. Tried android.target_sdk_value with same effect. If I should change target sdk, tell me exact build argument name. FYI I tested my app also on Android 4.3 emulator and Samsung Galaxy S3 with Android 4.3 and three dots at the bottom are not present, but this phone has menu softkey.

2. IO Exception: "No authentication challanges found for URL" on Android 4.3. It happens when I'm executing ConnectionRequest and server responds with 401 code. It is caused probably by lack of WWW-Authenticate position in server response header (http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F17121213%2Fjava-io-ioexception-no-authentication-challenges-found%2321534175&sa=D&sntz=1&usg=AFQjCNFO9D1FB3erWY7DFB2ZvuNjupWxHQ , http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F14550131%2Fhttp-basic-authentication-issue-on-android-jelly-bean-4-1-using-httpurlconnectio%2F14551482%2314551482&sa=D&sntz=1&usg=AFQjCNF1wy_nXF4eNQPthomtp7YFT4prRQ).

3. Android 4.4.2 issue only. I have form with Browser Component. I invoke setUrl("jar:///googlemaps.html") to load html file which  is included in the project. It looks like that:
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
            html { height: 100%; }
            body { height: 100%; margin: 0; padding: 0; }
            #map-canvas { height: 100%; width: 100%; }
            #map-canvas label { width: auto; display: inline; }
            #map-canvas img { max-width: none; }
        </style>
        <script type="text/javascript"
                src="https://maps.googleapis.com/maps/api/js?libraries=geometry&sensor=false&region=PL"></script>
        <script type="text/javascript"
                src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markermanager/src/markermanager.js"></script>
        <script type="text/javascript">
          unction initialize()
            {
                map = new google.maps.Map(document.getElementById('map-canvas'), {
                    center: new google.maps.LatLng(50.86857, 20.62160),
                    zoom:7,
                    disableDefaultUI: true,
                    zoomControl: true,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                });
                mgr = new MarkerManager(map);
                var styles = [{
                            featureType: 'poi',
                            elementType: 'labels',
                            stylers: [{
                                    visibility: 'off'
                            }]
                    }];
                map.setOptions({styles: styles});
            }
        //..rest of script
        google.maps.event.addDomListener(window, 'load', initialize);
       </script>
    </head>
    <body>
        <div id="map-canvas">Google Map</div>
    </body>
</html>
Internet connection is available (I'm consuming web services with no problem), but scripts embedded on that site does not load. Are you trying to tell me that google is blocking onself? Or maybe my part of script?

4. HTC One does not have menu soft key, maybe it has something to do with that 3 dots at the bottom. They also appears on splash screen created in GUI Builder.
5. Android 4.3 Galaxy S3 and HTC One (and possible another devices) but not Android 4.3 emulator issue. I have form with embedded Browser Component (stored as StateMachine object) which displays html page from point 3. When I call form.show() everything is fine. But when I invoke a JS function that add Marker to map via JS Bridge and then show, sometimes it instantly closes. But if I add a Dialog.show() to form.onShow(), then everything is OK.

Shai Almog

unread,
Feb 12, 2014, 1:00:55 PM2/12/14
to codenameone...@googlegroups.com
1/4. Its not wrong. Are you including other things in the build hints?
Facebook, ads etc?
Please remove all of them and check.

2. This was discussed here before, unfortunately this is an Android "bug" for which there is no known workaround other than using a different server as a proxy.

3. Google is blocking XSS attacks, it doesn't play favorites for google hosted code. That's part of the "fun" of doing web programming.

5. Its hard to tell what's going on really.
First make sure that there is no EDT violation going on using the simulators EDT violation detection tool.
Then check for race conditions.
Do you see any output in DDMS?

babtu

unread,
Feb 13, 2014, 3:52:49 AM2/13/14
to codenameone...@googlegroups.com
1. I never touched build hints.
2. Understood, thank you.
3. If they block all JS in WebView, it will be useless..strange move. Any workaround?
5. No EDT violations, no race conditions, I will check DDMS but I'm not expecting any breakthrough..

babtu

unread,
Feb 13, 2014, 10:12:02 AM2/13/14
to codenameone...@googlegroups.com
Update:
1. Today I tried to set android.targetSDKVersion to 15 once again and three dots disappeard. Maybe it was temporary NetBeans problem. Thank you.
3. I have updated Android on my HTC One to 4.4.2 and everything is working fine. Problem exists only in emulator. I'm wondering if it exists on another devices with that version, so I will try to do some tests using Samsung remote test lab tomorrow.
5. Nothing in the DDMS. But probably I have managed to recognise cause of that issue. I'm not sure why it happens on 4.3 but I think I will be able to work around it. If my solution success I will describe it along with circumstances in which problem appears.

Shai Almog

unread,
Feb 13, 2014, 2:22:23 PM2/13/14
to codenameone...@googlegroups.com
3. I didn't say they blocked JavaScript, just cross site scripting which from what I understand is related to what you have been doing.
Reply all
Reply to author
Forward
0 new messages