setBrowserNavigationCallback not working in Android 3.2

59 views
Skip to first unread message

akash....@more4apps.com

unread,
Jul 2, 2015, 9:30:31 PM7/2/15
to codenameone...@googlegroups.com
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans
Desktop OS : --
Simulator : All with ONLY android 3.2
Device : All with ONLY android 3.2

Hello,

I am using
((BrowserComponent) wb.getInternal()).setBrowserNavigationCallback(
                new BrowserNavigationCallback() {
                    public boolean shouldNavigate(String url) {
                        ..(my code)..
                    }
                });

It works very well in all Android version except Android 3.2

When I test in real device or emulator with Android 3.2, the web page is stuck.

Please see this video : https://www.dropbox.com/s/z2izo7izv4vbwmf/android%203.2%20login%20issue.3gp?dl=0

Do anyone have any idea please ?

Shai Almog

unread,
Jul 2, 2015, 11:51:06 PM7/2/15
to codenameone...@googlegroups.com, akash....@more4apps.com, akash....@more4apps.com
Hi,
If I understand correctly both newer and older versions of Android work correctly?
How do you do the login? Do you use our OAuth or something else?

akash....@more4apps.com

unread,
Jul 2, 2015, 11:55:47 PM7/2/15
to codenameone...@googlegroups.com, akash....@more4apps.com
No I am not using OAuth.

I am just calling my servlet and if login success then redirecting to some OA.jsp
and in mobile side I am just checking for the URL in shouldNavigate() method.

Shai Almog

unread,
Jul 3, 2015, 10:01:11 AM7/3/15
to codenameone...@googlegroups.com, akash....@more4apps.com, akash....@more4apps.com
And this doesn't happen in 3.1 or 4.0 devices?
Can you clarify what's not working exactly?
Does it invoke shouldNavigate?
Does it pass the wrong argument?

akash....@more4apps.com

unread,
Jul 5, 2015, 5:49:47 PM7/5/15
to codenameone...@googlegroups.com, akash....@more4apps.com

Hello Shai,

I put a log in ShouldNavigate() method as below


((BrowserComponent) wb.getInternal()).setBrowserNavigationCallback(
                new BrowserNavigationCallback() {
                    public boolean shouldNavigate(String url) {
                        Log.p("URL being called is " + url);
                        ...My Coding and conditions to move in app...
}
});

and I found that
** in case of ANDROID 3.2 **
- When I call first login screen, it prints the URL and just show web page.
- After that when I click something in that web page then it call this ShouldNavigate() and then my application screen is visible, instead it is expected that it should do it automatically same as in other Android devices.
** in case of ANDROID 2.2 or 4.0 and rest (except 3.2)**
Where in all other OS version (except 3.2) it is calling both URL consecutively.

FYI:
What I am doing is, in 1st web page I am calling Login screen. When login is successful I am displaying Home screen which then redirect to some OA.jsp.
Now in my application I am checking if URL is OA.jsp then I am showing form. So in 3.2 it is not able to redirect automatically.
Does it pass the wrong argment?

Shai Almog

unread,
Jul 5, 2015, 11:57:55 PM7/5/15
to codenameone...@googlegroups.com, akash....@more4apps.com, akash....@more4apps.com
Hi,
so for 3.2 the return value from shouldNavigate is ignored?

akash....@more4apps.com

unread,
Jul 6, 2015, 12:07:43 AM7/6/15
to codenameone...@googlegroups.com, akash....@more4apps.com
Sorry, didn't get your point by ignored ?

I think it is not calling the ShouldNavigate() automatically same as in
other versions.. but If I touch on link manually then it is
See this photo


After I do successful login, it shows me this screen and when I touch any
of the link from that left list then it is firing ShouldNavigate event and
then it check my conditions.

Instead, in other OS Version it is automatically making a call (without
touching any of the link) and is calling ShouldNavigate method after
successful login.

Thanks,

Shai Almog

unread,
Jul 6, 2015, 10:23:02 AM7/6/15
to codenameone...@googlegroups.com, akash....@more4apps.com, akash....@more4apps.com
So the issue is that shouldNavigate isn't invoked for browser internal redirects (302 headers) only for explicit navigation?

akash....@more4apps.com

unread,
Jul 6, 2015, 5:42:27 PM7/6/15
to codenameone...@googlegroups.com, akash....@more4apps.com
Yes, its not invoking automatically 3.2.
Manually I have to click on link then it fires that event.

Shai Almog

unread,
Jul 7, 2015, 1:20:42 AM7/7/15
to codenameone...@googlegroups.com, akash....@more4apps.com, akash....@more4apps.com
Can you file an issue on this?

We'll have a look. It seems to be related to this issue: http://stackoverflow.com/questions/10077843/android-webview-302-redirect-honeycomb
But I think its just an Android bug that wasn't fixed, I'm not sure if there is a workaround other than "upgrade". Since its in the web view there probably isn't much we can do.
Reply all
Reply to author
Forward
0 new messages