Custom tab does not close, different behavior for Android versions - chrome-custom-tabs

My app is opening a custom tab to connect to my server. My server processes user input and then returns to the app using a javascript intent and extras - the intent is set to open an activity with the needed browsable intent filter.
The browser is retaining focus. How do I get the anchor on the HTML button to correctly open the app and disappear the browser window when the user triggers the javascript Android intent with the button on the HTML page?
The behavior is not consistent. Android 4.2 can work correctly with the custom tabs while Samsung Android 6 works once and then fails when the user returns to the browser. Tabs fail in an inconsistent way on the newer versions of Android. If I disable tabs to workaround and use the system browser for Android 6, then the Android 4 system browser fails in the same way that the tabs fail. This makes me think there is some obvious gap in the html. When the javascript intent is called I see that the app getting the intent and extras -> the deep link works. The browser window, however, stays on top. Is there some trick to the HTML programming on such an intent? The user gesture is there. What else do I need? Can I leverage the callbacks and request focus?
Thanks in advance for your kind assistance.

Turns out the issue was just that the Activity opened by the javascript intent had no UI and immediately finished. For some reason, I thought that Android would stay inside my app but the backstack just did what it usually does.
The answer was to start the app's MainActivity before finishing the activity started with the javascript intent. Finishing it without intentionally coding the app to go to another activity inside the app meant that I would return to the custom tab, return to the browser. It looked as if the browser was retaining focus when in fact the javascript intent started the activity and returned to my app but the activity finished and focus returned to the custom tab that called that activity.

Related

Xamarin.Forms: How to dismiss the ActionSheet in Android when the app goes to sleep mode?

I have a solution to dismiss the ActionSheet from iOS using the RootViewController.
But I am unable to crack this for Android as I don't see any class that can give me control on the ActionSheet.
The requirement is to close this action sheet (if it was opened) when the application goes to sleep mode. We bring up the login screen when it wakes up from sleep- but it also shows ActionSheet with the login page since it was not closed. We do not close the current page either, when app sleeps- we keep it in the background, on login we show the last active page again.

IE Window close issue with linkedin javascript SDK

I am using the sign in with LinkedIn javascript SDK on a site. However, some IE and Edge users are experiencing an issue with the login popup. Instead of seeing the login screen, they get a window that says "The webpage you are viewing is trying to close the window. Do you want to close this window? Yes/No".
If yes is clicked, the window closes. If no is clicked, there is a 404 error.
I believe this has something to do with IE/Edge security and privacy settings or, the SDK may be calling a close() function without an open().
Maybe the linkedIn SDK needs to be edited or, is there a way for me to check for the security settings with js prior to showing the login with LinkedIn button?
Has anyone experience this?

JWrapper doesn't auto-update when launched from URL

I have a JWrapper app that registers itself as a URL handler, as described in the docs.
String vappName = JWApp.getMyVirtualApp().getUserVisibleName();
JWMacOS.registerURLSchemeForVirtualApp("myapp", vappName);
The URL handler part works great, and my app launches just fine when I click on a myapp://foo/bar link.
The same app is also configured in the jwrapper.xml file to check for automatic updates, and that's where things get interesting. When I launch the app from the dock (by clicking on the icon), the app checks for updates and can successfully update itself, as expected. However, if the app is launched via a URL, the update check is skipped.
No matter what I do, I cannot get the app to automatically update if it is launched from a URL. I can launch it via URL several times in a row, and it never updates, but it will update just fine the next time I launch it via the dock icon.
Is there a way to get JWrapper to check for updates when launched from a URL? I have tried setting MatchClientVersionToServerVersion to both true and false, but it doesn't seem to help. Perhaps I am registering the URL handler incorrectly?
Updated: Just wanted to note that I implemented the JWrapperUpdateApp install screen for debugging. It pops up a little JOptionPane alert letting me know that it is checking for updates. I see that alert as expected when I start the app from the dock, but never when I launch it from a URL.

Page Inspector doesn't handle New Windows from Javascript

I have an ASP.NET application I've inherited and am trying to debug. I'm using Page Inspector in VS 2012 Express to work on a particular page that has lots of JS in it. Unfortunately, that page is opened as a popup whose URL is dynamically generated by JS. Page Inspector does not seem to handle this well.
If it just popped out into the new window, that would be OK because I could then get the URL and paste it back into the main PI window. However, it seems to lose the session reference when it pops up, because it logs me out of the application, and when I log back in I lose the location I was at.
I've tried changing the function that does the URL generation / window opening to a window.location.href, but that doesn't seem to work either; it just stays on the same page.
The references to the URL generation functions are done in such a way that it would be a lot of work to switch it from calling a JS function to just a straight link on the page, especially since I would have to switch it back for production.
Any ideas on how I can configure Page Inspector to handle popup windows better?
Thanks.

Open a new browser window, or set focus to an existing browser

I'm using code similar to the following:
http://blog.flexexamples.com/2007/08/29/launching-new-browser-windows-from-flex/
I have a Flex app running in AIR, and when I click on a URL it opens a new tab in my existing browser. In addition to this the focus doesn't set to the browser. What this means is that I'm not aware of the URL opening in the browser unless I actually change focus from the app to the browser.
Is it possible to open a brand new spanking browser, or change focus to the browser so its really obvious to the user?
Thanks.
There is nothing you can do in AIR / Flex to make this happen. The behavior your seeing is due to operating system and browser settings. In AIR, navigateToURL just passes the URLtot he OS which handles the URL based on defaults.
If memory serves me, my firefox install ued to open in a new tab by default, but there was some setting I used to make it always open in a new window. Quick googling did not provide me the answer, though.

Resources