Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Quick Script for Social Sharing and app Availability



  • Are you looking for a way to promote your applications?
    We’ll need two Plugins:

    https://github.com/LeoCFMoura/AppAvailability
    https://github.com/LeoCFMoura/SocialSharing-PhoneGap-Plugin

    <ons-col class="action-col" onclick="checkFacebook();">
    <div class="action-icon"><ons-icon icon="fa-facebook"></ons-icon></div>
    <div class="action-label"> Facebook</div>
    </ons-col>
    
    <script>
            function checkFacebook() {
                appAvailability.check(
                    'com.facebook.katana', // Package Name
                    function () {           // Success callback
                        window.plugins.socialsharing.shareViaFacebook(' your message here', null /* img */, ' http://www.yourwebsite.com/' /* url */, function () { console.log('share ok') }, function (errormsg) { alert(errormsg) })
                    },
                    function () {           // Error callback
                        ons.notification.confirm({
                            message: 'facebook is not installed. Do you want to install?',
                            title: 'Facebook unavailable',
                            buttonLabels: ['Yes', 'No'],
                            animation: 'slide',
                            primaryButtonIndex: 1,
                            cancelable: false,
                            callback: function (index) {
                                if (index == 0) {
                                    window.open('https://play.google.com/store/apps', '_system')
                                } else if (index == 1) {
                                   
                                }
                                
                            }
                        });
                    }
                );
            }
    

  • Monaca

    @Leonardo-Augusto thank you for sharing this quick but useful example!



  • @Leonardo-Augusto Awesome sample! I can definitely use it on some projects.



  • Thanks guys :relaxed:
    It came after a great problem here: i have on my apps a similar command , but when i don’t have an app , the user receives a message with the available packages. It’s not good! So , now i can show a better message.