Detect android browser tab switch - android

I would like to detect when a user switches tabs within the native Android web browser (other web browsers would be a plus). Is there an event that gets raised when this occurs that an outside app can trap or would I have to create my own application with a web view inside if and detect this from within my own custom browser?
I researched the following but to no avail. They were not very relevant to my goal:
Switching tabs but not very Android-specific
Tab-related activity in Android
Switching tabs in Android
My goal is to determine how much time a user spends viewing a particular web page before navigating away or leaving the app completely.

Related

Xamarin Forms for Android Tv Application

I developed an application that has different pages, the first page contains some buttons to navigate to other pages
I run it in my mobile, it works fine, and I run it on my tv (Andoird Tv), it runs but I can't click on buttons to navigate to others page by REMOTE CONTROL
How can I handle keys remote control in my app Xamarin forms
Thank's
Press tab key to make your Button focused.
Then you can use REMOTE CONTROL to switch focus and click.

Detecting if a page crashes within an Android WebView

I have a WebView within my android application that displays a webapp which occasionally will crash if something goes wrong (Like an "Aw snap" Google Chrome crash). I want to detect if this page has crashed, and reload it if it has.
Is there any way to detect if the page within an Android WebView crashes and then reload said page?

Blank White Screen when deploying to Android from Worklight; iOS works normal

I have a Jquery mobile app that loads one view on a changePage event inside of a webview and then loads another view when input is received from the user and a button is clicked. The first changePage event loads fine. However, the second changePage event does not show any content. The screen changes only to a blank, white screen.
This issue only appears on Android 2.3 +. I have enabled hardware acceleration. The weird thing is that the first view (a login view) works fine. It only occurs when I do a second change page event. This app works great in a standard browser and also works good on the iPhone. I get the same issue when using an Android emulator.
My Worklight version is: 6.1.0.00.20131219-1900. I am able to port this app to iOS 7 and below. It just is not working completely on any Android device that I test with.
Anybody have any idea on what needs to be tweaked to get this web app to continually load in a web view? Any help is appreciated.
After receiving your project and doing some investigation I believe I have found the cause of this issue. Inside of your application you make a call to a load a specific view (normal view in your case) in a changePage event after an event is triggered (a button click). The problem is that when you referenced the view in your code it did not match the correct name of the view you were attempting to load. Please make sure when referencing these files you have the correct spelling and correct case structure.

jQuery mobile on Android phone: pages rendered from brower's history are broken. How do I force a complete page rebuild?

All!
I have a perplexing problem that occurs only on some specific phones-- but they're the phones that my customer wants the app written for, so I need to deliver. :-/ The site that I am working on consists of fourteen jQuery mobile "pages", and two of them are exhibiting the following behavior:
I have an issue where pages being loaded from the browser's cache-- whether by pressing the browser's "back button" or simply reloading a page that has been previously rendered-- is broken:
While the page renders correctly, the bottom of the page is either "cut off" and can't be scrolled to, or a medium amount of "new" blank content is inserted at the bottom of the page.
When the latter occurs, the UI controls are "shifted" by the length of the new blank content compared to where the user was tapping: If an inch was "inserted" when the page is displayed for the second time, tapping on the screen triggers a click event in the location an inch "higher" on the page than where my finger touched the screen.
I will note that this problem appears to occur only on pages that have enough content to scroll off screen; pages that have small amounts of content do not suffer this problem. There is no dynamic content being added to these pages.
It appears that once a page is created and then a different page is displayed, something breaks in the DOM when the previously-created page is redisplayed.
The mobile sites run perfectly in Chrome and Firefox on a PC; they manifest themselves only on certain Android phones. One phone model that is giving me particular headaches is a Samsung SGH-I437P running Android 4.1.2.
I'm using the latest versions of jQuery-- rev 1.9.1 of jQuery, and 1.3.2 of jQuery mobile.
What I think I need to do is to tell jQuery to completely rebuild the page, but am unsure if this is even feasible, as the since the page has already been loaded into the DOM with all the jQuery mobile "embellishments"-- so there's no "bare-bones non-jQuery-mobile" HTML to rebuild the page with.
However, searching for page rebuilding / reloading hasn't turned up any concrete hits-- there was a way to do this with older versions of jQuery Mobile, but this does not work for the latest version.
Has anyone else experienced this behavior and know how to counteract it? My team of two have been focused on this for weeks to no avail.

Should I be getting a warning box from the android browser in a cached html5 app when offline?

Using Android 2.3.5 Gingerbread built in browser. Created an offline cached app using html5.
When I turn the network off, the pages seem to cache ok but moving from page to page I get a message warning me there is No Network Connection (with settings / OK buttons). If I press OK you can move to the next page (also cached) but my users are not happy having to press the OK button every time they go from one cached page to the next.
On a an Android 4.0.4 tablet, the internal browser does not generate the message when network is off.
Can anyone confirm that this is standard Gingerbread behavior for a cached HTML5 app or did I do something wrong? Is there any low level setting to suppress that message?
My only other thought is to cram all the pages into a single page and show/hide them rather than navigate from page to page. Or just build a native app.
I'd switch to Chrome but it won't run on Gingerbread.

Categories

Resources