0

i am using this plugin SocialSharing-PhoneGap-Plugin

i have used this code

<!-- unlike most apps Twitter doesn't like it when you use an array to pass multiple files as the second param -->
<button onclick="window.plugins.socialsharing.shareViaTwitter('Message via Twitter')">message via Twitter</button>
<button onclick="window.plugins.socialsharing.shareViaTwitter('Message and link via Twitter', null /* img */, 'http://www.x-services.nl')">msg and link via Twitter</button>

i have twitter app in my mobile It is working fine. i don't have twitter app in my mobile it is not working. can you help me? suppose if i haven't twitter app in mobile.automatically goto Web browser share my content

Angu
  • 862
  • 2
  • 13
  • 32
  • Does the plugin documentation tells anything about needing applications to be installed on the phone? – Cristik Apr 16 '15 at 09:46
  • i think no @Cristik . that documentation only twitter,facebook share content ios and android phone only – Angu Apr 16 '15 at 09:48

1 Answers1

1

We had the same issue, and found a solution.

Actually, you can use 5 parameters for shareByTwitter function, the last one is onError function, which is launched when Twitter App is not installed. So we added call to Twitter sharing page in this function, now it works fine :

window.plugins.socialsharing.shareViaTwitter(
    /* message */ 'Message via Twitter', 
    /* img */ null, 
    /* url */ yourPermalink , 
    /* function onSuccess */ function() {
        console.log('share ok');
    }, 
    /* function onError */ function(errormsg){
        // when Twitter app is not installed : directly open twitter on web browser
        window.open('https://twitter.com/share?url=' + yourPermaLink, '_blank');
    }
)

(see https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#sharing-directly-to)

You could also choose to redirect the user to Twitter application on PlayStore or AppStore, using market:// or something like that.

Hope it can help

Enarual
  • 11
  • 1