Checking to see if app exists on users phone and if not, link to Safari

5 posts, 0 answers
  1. Alain
    Alain avatar
    1 posts
    Member since:
    Aug 2013

    Posted 06 Dec 2013 Link to this post

    Hi there,

    I have 3 links in our app to facebook, twitter, etc... I have the links opening in the facebook and twitter apps (e.g. fb://, tw://). Works great if the user has them installed on their phones but if not, this results in a 302. Is there a way to detect if a user has an app installed and if not, then use an external link (which I already know how to do)?

  2. Steve
    Steve avatar
    10941 posts

    Posted 11 Dec 2013 Link to this post

    Hi Alain,

    There is no out of the box way to accomplish this, but it can be done via custom Cordova plugin, check this one.

    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Marcelo
    Marcelo avatar
    9 posts
    Member since:
    Oct 2013

    Posted 03 Feb 2014 in reply to Steve Link to this post

    The plugin looks great, but even after following instructions found here:

    I was not able to get the plugin to work. Yes, I double checked EVERYTHING and tried multiple variations of configuring the config.xml file, adding script includes to index.html, etc. And I was very careful to reset the original files during each variation to ensure I wasn't accidentally mangling the custom plugin setup code.

    The frustrating part is that the plugin is plugman compatible and has detailed instructions here:

    Would it be possible for someone from the AppBuilder team to provide a quick bullet-point list of instructions on installing this custom plugin in an AppBuilder project? I am using AppBuilder desktop on windows (formerly "Graphite") and targerting Cordova 3.2 (the plugin targets >= 3.0, so ti should work).

    It would be immensely helpful if someone could provide a simple list of instructions on installing this specific plugin (or any other one for that matter) so that we end users of AppBuilder could compare the the code of the plugin and what needs to be altered in our actual project to get them to work.

    Unfortunately, the generic instructions already provided in your documentation hasn't worked, and thus providing a concrete example with an actual plugin would be greatly appreciated.

    Thanks in advance for considering this request.

  4. Marcelo
    Marcelo avatar
    9 posts
    Member since:
    Oct 2013

    Posted 03 Feb 2014 in reply to Marcelo Link to this post

    So I got this plugin partially working... works as intended on Android (able to tell me if Facebook app is already installed on device or not). However, when attempting to use with iOS7 (only version tested) it fails.

    I get a "TypeError: 'undefined' is not a function (evaluating 'window.appavailability')" in the debugger (device directly connected via cable to AppBuilder). This is happening because the AppAvailability.js script is not being reached (404 not found) for some strange reason. 

    I am certain this has something to do with customizing a setting as it related to using imported custom plugin.

    I double checked the line in plugin.xml for this plugin:
    <asset src="www/AppAvailability.js" target="Plugins/AppAvailability/AppAvailability.js" />

    Because as I understand it, this will point to the correct relative folder for the plugin when we add the script include in the page we are trying to use the plugin on: <script type="text/javascript" src="Plugins/AppAvailability/AppAvailability.js"></script>

    Again.. this works perfectly fine with Android (and yes, I am calling  the plugin function only after cordova.js has fully loaded).

    The call that is working for Android is: 
    window.appavailability('com.facebook.katana', function(availability) {
        // availability is either true or false
        if(availability) { console.log('Facebook is available'); }

    Has anyone been able to successfully implement this in AppBuilder for iOS as well?


  5. Steve
    Steve avatar
    10941 posts

    Posted 06 Feb 2014 Link to this post

    Hi Marcelo,

    The Working with Custom Plugins section in our documentation covers everything that is required to get a custom plugin to work. As per the Reference the Custom Plugin in index.html and config.xml help article,
    the value for src in <script> must match the value for target in <asset>, which is not the case in your project. Modify your script include and if you're still having problems, simply open the .ipa with an archive program and identify where is the AppAvailability.js file copied to upon build.

    Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
Back to Top