I'm building an app using Xamarin.Android which is meant to open a URL in Chrome when a user taps on a cell. Everything was working just fine up until a couple of hours ago. It was working fine on one device but not on another. There was no indication as to why it was not opening Chrome on one of the phones. After some time, I manually opened Chrome to make sure that everything was alright with it and found out that it had automatically updated itself a couple of minutes earlier and I had not accepted their Terms & Conditions. After accepting them, everything was working just fine again.
My issue is that there is no indication that the problem is with Chrome's EULA and it looks as if my app is the one which has the problem.
I'm using the code below to launch the URL using the CustomTabsLibrary:
var intent = builder.Build ();
var mgr = new CustomTabsActivityManager (this);
mgr.CustomTabsServiceConnected += delegate {
mgr.LaunchUrl ("http://xamarin.com", intent);
};
mgr.BindService ();
The callback below gets called when Chrome is not installed on the device, but this not the case. In our case if the user does not accept the EULA of Google Chrome's app, we don't have any available callback to know and as a result, it doesn't redirect the user to the URL.
if (!mgr.BindService ()) {
// Cannot use Custom Tabs,
// Launch the URL another way
}
Has anyone ever had this issue before? Is there any way we can solve this issue?
CustomTabsLibrary
Relevant question on Stackoverflow
It appears that Google has now fixed the issue on Chrome. When TOS have not been accepted by the user, the callback is now called and launches Chrome, as it should, taking you to the screen where you can accept the TOS.
Related
I'm trying to implement Firebase dynamic links in my app.
I'm using custom domain of mine (instead of the one provided by firebase).
It works most of the time.
However, on a specific device (Samsung A7), the dynamic link is sometimes null
Here's the standard code for pulling the dynamic link:
FirebaseDynamicLinks.getInstance().getDynamicLink(intent).addOnSuccessListener { dynamicData ->
val link = dynamicData?.link
if (link != null)
{
Log.i(TAG, "pullDynamicLinkAsync", "dynamic link found")
}
}.addOnFailureListener {
Log.i(TAG, "pullDynamicLinkAsync", "dynamic link not found")
}
The steps of my test:
Click on the shared dynamic link -> Play store page of my app (previous version) gets opened
Make a fresh install of the app from Android Studio
Call the above code directly from onCreate method
As I said, most of the time it works and I get the link.
Could it be an issue related to the specific device? Maybe Play services issue? Or limitation?
EDIT (03/12/2020):
It seems like this issue is somehow related to Chrome browser.
When I press the dynamic link and the browser (in this case - chrome), opens, The following line gets printed in the log most of the time:
**I/ActivityManager: START u0 {act=com.google.firebase.dynamiclinks.VIEW_DYNAMIC_LINK ...**
If the line appears in the log, I always received the dynamic link in my app
If the lines doesn't appear in the log, I never receive the dynamic link in my app
The issue happens only with chrome browser.
If I open the link with other browser (Firefox, build in browser..) it always works.
I have implemented login using ChromeCustomTabsBrowser. After successful login, if app's Open Supported links setting is set to "Ask evety time" instead of "Open in this app", response is not getting back to the app and showing 404 screen as attached in screen.
Interesting - looks like you are using an https scheme for redirects and here is how we'd like the technology to work:
You are automatically deep linked back to your app when a login response is received over the https URL.
However, in practice I believe this is what happens:
Almost all mobile browsers try to run an internet hosted web page instead
A claimed https scheme solution is very hard to achieve and rarely used in practice today - more of an aspiration than a reality? But I believe it would need to work like this:
Capture the response on the internet web page which runs on your mobile device
Then deep link back to the app
A similar approach is used by a sample internet web page of mine - do a view source to see the logic
If it helps I have a demo Android sample that instead uses the more mainstream option of private URI schemes - though I may update it to claimed https schemes one of these days.
Code
Explanatory Articles
Even getting this form of Chrome Custom Tab based login working was a struggle, and my posts have some lessons learned that may be useful.
I'm building a meteorjs app and deploying it as a native (cordova) app for Android and iOS.
I need to deep link to my app, so I can launch it by following a link on a website.
I've implemented URL Scheme using the cordova plugin by Eddy Verbruggen (https://github.com/EddyVerbruggen/Custom-URL-scheme) and I managed to get my app launched by following a link of the "myapp://" format.
The problem is that, even though the app is getting successfully launched, the handleOpenUrl hook is not getting triggered.
Meteor.startup(function() {
handleOpenURL = function handleOpenURL(url) {
console.log("received url: " + url);
// parse url and proceed accordingly
}
});
Nothing gets logged. So I have no way of passing any parameters to my app, or even detect that the app was launched via a link that follows the 'myapp://' URL scheme.
Also, I noticed that even though my app is already open, if I switch to the browser and click on a special "myapp://" link, instead of switching to my (already open) app, a new instance of the app is getting launched.
[edit] Turned out the two problems were related. Once I prevented a new instance of the app from being initialized, the handleOpenUrl function was triggered successfully.
I'm using the Android emulator for all my tests. I haven't had the chance to test on iOS yet.
[edit] iOS didn't give this problem at all. It was only an Android problem.
If anyone out there has any experience on implementing custom URL scheme in meteorjs, your feedback is much appreciated!
I managed to fix the issue I was facing. Here is the solution, for anybody else who is facing similar problems.
First of all, it was only occurring on Android. iOS had no problem whatsoever to launch the app and trigger the handleOpenUrl function.
The two issues that I was facing on Android turned out that there were related to each other. The fact that a new instance of the app was triggered every time, prevented the handleOpenUrl function from being triggered.
Both problems were fixed by adding a single line of code on the mobile-config.js file:
App.setPreference("AndroidLaunchMode", "singleTask");
I've been redirecting my users for the past year from my domain:
http://example.com/get
to: market://details?id=com.example.myapp
Today I've check this on Nexus 5/LG G3/OnePlus One from the chrome browser app and it stopped working!
Now, when my users try to download the app they are redirected to a broken link.
Anyone know anything about this change in the Chrome app in Android?
from reading the chrome's version 40 release, there are some insight i d like to share
http://blog.chromium.org/2014/12/chrome-40-beta-powerful-offline-and.html
they updated to Content Security Policy Level 2, which has a stronger control over redirects.
https://w3c.github.io/webappsec/specs/content-security-policy/#changes-from-level-1
The path component of a source expression is now ignored if the resource being loaded is the result of a redirect, as described in ยง4.2.2.3 Paths and Redirects.
Redirects are blocked by default, and explicitly allowed with a new unsafe-redirect expression.
So I did some testing. if your initial action started from redirect (no matter window.location or http 302) it will show an error. but once i created a hyperlink to market:// and explicitly clicked it, it worked fine.
for now i ended up creating a webpage in between, where i ask the user to click the link to proceed.
I was testing this url on different devices with different OS/Play Store/ Play Services/ Browsers. looks like it's related to browser but not OS or Play Services.
Initially I updated Play Services and Google Play Store and my old Chrome (v18) was opening market://details?id= url fine.
Afterward I had updated my Chrome (v18) to version 40. And it's not working any more.
Meanwhile, FireFox and default "Browsers" still opens this url and redirects to Google Play Store app.
P.S. I have registered issue in Chromium bug tracker. Let's see if there will be any response:
https://code.google.com/p/chromium/issues/detail?can=2&q=market&colspec=ID%20Pri%20M%20Week%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id=454396&thanks=454396&ts=1422888121
UPDATE [6.05.15] : Unfortunately, they decided not to fix this issue, saying, that it's planned behaviour. As they said, user should click the link by himself. Only then re-direct to the app on devices is allowed.
So, there is only one "work-around", that I see for now: create a page, that contains text like "Click link below to go to the app", followed by link like:
Load Example App
or
<a href="intent://foo.bar#Intent;scheme=blabla;package=com.example.myapp;end" > Load App/ Activate your Profile </a>
Try the link below, replacing your.app.id with your own identifier:
https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=your.app.id&ddl=1&pcampaignid=web_ddl_1
Not really sure how to correctly describe this so hopefully some of you know what I mean.
Our client is getting a mobile app for thier site, hopefully soon, and I have noticed on android devices and sure they probably exist on iphones too, a popup to inform you that said site has an app. I have seen it on forums that support tapatalk as well as the sammobile.com website. Its a small message and an "ok" and "cancel" button, ok takes you to the app in the market.
Googles only really helpful when you know or at least can correctly describe what you are looking for.
Does anyone know
A) Do iPhones also have this feature and
B) how would I go about triggering such a popup/notification?
Using some infor from a java push trigger as well as a few other Stacks I put this together.
if (/Android|iPhone|BlackBerry/i.test(navigator.userAgent)) {
var url = confirm("Would you like to download our mobile application?");
if (url === true) {
var url = window.location.href = 'http://www.google.com';
url.show();
}
}
Will test for the 3 devices mentioned, if so will create a confirmation box for which confirmation will direct the user to another url.