Email link to launch an app

You must Login before you can answer or comment on any questions.

hi,

I am trying to email a link through my app which actually opens the app if it installed in their phone.

var ch ="<a href='Myapp://?var1="+var1+"&var2="+var2+"'>Click Here</a>"; emailDialog.messageBody = ch;

I have set the email dialog to send emails as html. But at the receiving end to user, who opens up the email in safari or any browser, the link looks like this <a>Click Here</a>

When i have another app with a local html opened in webview and also hardcoding the above url in the html.. it works perfectly.. Problem is that the url changes when sent through email from phone or browser...

Can somebody please guide on forming the url and setting it message body.. when sending it through Ti.UI.EmailDialog?

thanks asghar

— asked 2 years ago by asghar ali
2 Comments
  • A more complete code example might help in getting you some answers on this. When all the community has to do is copy and paste code to test your app, then you will receive not only more answers, but better quality ones.

    Try putting together a quick and simple test app that duplicates your issue and posting that code.

    — commented 2 years ago by Anthony Decena

  • hi anthony,

    This is the code that i have

    var emailDialog = Titanium.UI.createEmailDialog();
        emailDialog.subject = "Some Subject";
        emailDialog.toRecipients = [];
        var ch ="<a href='Myapp://?var1="+var1+"&var2="+var2+"'>Click Here</a>";
        emailDialog.messageBody = "Download My and "+ch+" to open it";
        emailDialog.setHtml(true);
        emailDialog.addAttachment(someimgasattachment);
        emailDialog.open();
    Just trying to send an email with a link to open the app if installed in the phone -I have made sure that the custom url schemes are registered with the app.

    I figured it out that the link works well with an default mail app of phone but not through the browser and i guess i am pretty much happy with it for now... but would still love to know why it does not work in a mobile phone browser?

    thanks

    asghar

    — commented 2 years ago by asghar ali

1 Answer

In most html mail scenarios, you need to add the html and body tags around your content, just as if it was an html page. The clients do this automagically in most situations, and some even include default stylesheets. I don't know if the titanium code does that automatically for you, of it its the programmers responsibility to do that.

Your Answer

Think you can help? Login to answer this question!