iOS Question Register Url Scheme

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

Does anyone know how to register a url scheme for the app so that I can open my B4i App from another app ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Yes.

Add this attribute:
B4X:
#UrlScheme: my.unique.scheme

Add this sub:
B4X:
Sub Application_OpenUrl (Url As String, Data As Object) As Boolean
   Log("Received Url: " & Url)
   Return True
End Sub

You can now start your app with:
B4X:
Application.OpenUrl("my.unique.scheme://HereYouCanAddAnyTextYouLike")
 
Upvote 0

JanPRO

Well-Known Member
Licensed User
Longtime User
Hi,

just create a index.php in the xyz directory and set the following code:

<?php
$ipad = (bool) strpos($_SERVER['HTTP_USER_AGENT'], 'iPad');
$iphone = (bool) strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone');

if ($iphone or $ipad ) {
header('location: my.unique.scheme://HereYouCanAddAnyTextYouLike');
}else{
echo("No iPhone or iPad");
}
?>
 
Upvote 0

klarsys

Active Member
Licensed User
Longtime User
Thanks!

I understand that there is no direct way to register an app with http based scheme like in Android. It has to go through web page as described above.
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hello
There is a similar feature for Android?
thank you
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Hi,

just create a index.php in the xyz directory and set the following code:

<?php
$ipad = (bool) strpos($_SERVER['HTTP_USER_AGENT'], 'iPad');
$iphone = (bool) strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone');

if ($iphone or $ipad ) {
header('location: my.unique.scheme://HereYouCanAddAnyTextYouLike');
}else{
echo("No iPhone or iPad");
}
?>

Is it possible if the app is not installed on the device direct to appstore ? What code we must add for that to php side ?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top