iOS Question #URLScheme and Universal Links

Erel

B4X founder
Staff member
Licensed User
Longtime User
It should be possible to use universal links however it will require some work.

A very simple solution is to use URLScheme with a custom scheme.

For example if you go to this page and click on the link it will open B4iBridge:
https://www.b4x.com/b4i/files/test.html

The link:
B4X:
<a href="b4ibridge://test">Testing...<a>
 
Upvote 0

fbritop

Active Member
Licensed User
Longtime User
Thanks @Erel , the question is how to make it global. We have an app that usually send administrators, an email with the requests that needs their attention.

How can we make the URL link globally registered on a single URI for iOS and Android.

Android needs a plain url as https://app.yourdomain.com/path
iOS needs a plain protocol app.yourdomain.com//path

I have looked up the timeout solution for iOS, but I cannot figure out how to solve it for Android, because if you force the window.location to the URLScheme, it goes on the browser to the web page. If I use window.open it works, but usually this is blocked on most browsers.

If users land on a common url which exists on a web server, I can do the following

B4X:
<a href="//app.llavemovil.com" id="Link">Testing...hhh</a>
<script>
var userAgent = navigator.userAgent || navigator.vendor || window.opera
userAgent=userAgent.toLowerCase();
$(function(){
    setTimeout(function() {
      //alert("TEST")
      //window.location = "http://itunes.com/apps/yourappname";
    }, 100);
    var URI=""
    if(userAgent.indexOf("iphone")>=0){
        
        //window.open("app.llavemovil.com://test")
        URI="app.llavemovil.com://test"
    }else if(userAgent.indexOf("android")>=0){
        URI="https://app.llavemovil.com"
        //window.open("https//app.llavemovil.com")
    }
    if(URI!=''){
        $("#Link").attr("href", URI).text(URI)
    }
});
</script>

THe timeout function as I said before it works with iOS, but I have not found a way to achieve the same result with Android. Even with a jQuery forced click wont work either $("#Link").click()
 
Upvote 0
Top