Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codename one android intercepting urls issue

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

like image 511
Kyri33 Avatar asked May 03 '16 09:05

Kyri33


1 Answers

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.

like image 164
Chen Avatar answered Oct 17 '22 22:10

Chen