I am having a problem intercepting urls with android on codename one. I got it working fine for ios using the build hints ios.urlScheme and ios.plistInject. The build hint I used for android is:
android.xintent_filter=<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mibrand" /> </intent-filter>
However android is not registering the text "mibrand://..." as a link and therefore it is just plain text, not clickable on any android devices. What am I doing wrong?
Here is my php code
<?php
$store = $_GET['ref'];
$id = $_GET['id'];
$link1 = "mibrand://";
$link1 .= $store;
$link1 .= "/";
$link1 .= $id;
$link2 = "http://www.mibrandapp.com";
?>
<a href="<?php echo $link2 ?>"></a>
<a href="<?php echo $link1 ?>"></a>
Then I set the link to share to mylink/share.php?ref=store&id=56
It doesn't work on ios either
You need to place this inside an html page and add the link yourself then share that page to your users
<html>
...
<a href='mibrand://...'> open my app </a>
...
</html>
I've just verified that this works using http://codenameone.com/testm.html which is effectively:
<html>
<head>
<title>Mibrand Test</title>
</head>
<body>
<a href="mibrand://launch"> open my app </a>
</body>
</html>
And I used the build hint as described above which maps to the codenameone_settings.properties
as:
codename1.arg.android.xintent_filter=<intent-filter> <action android\:name\="android.intent.action.VIEW" /> <category android\:name\="android.intent.category.DEFAULT" /> <category android\:name\="android.intent.category.BROWSABLE" /> <data android\:scheme\="mibrand" /> </intent-filter>
If you need this to work from email just redirect to HTML that includes JavaScript code that redirects to that link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With