Icenium Social Sharing Custom Plugin

17 posts, 0 answers
  1. Developer
    Developer avatar
    2 posts
    Member since:
    Dec 2013

    Posted 20 Jan 2014 Link to this post

    Hi all.
    I have trouble to add social sharing plugin.
    https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
    I used this plugin.
    Here is test module.
     if (typeof window.plugins.socialSharing !== 'undefined'){
          // plugin is available
        alert("okay!");
            window.plugins.socialSharing.share('Message and subject', 'The subject');
        }else{
        alert("nope!");
        }
    I can always get "nope!" alert.

    and I used this on plugin.xml file and didn't import the SocialSharing.js on index.html.
     <js-module src="www/SocialSharing.js" name="SocialSharing">
        <clobbers target="plugins.socialsharing" />
      </js-module>

    Please help me.

    Thanks so much
  2. Jeelig
    Jeelig avatar
    31 posts
    Member since:
    Feb 2013

    Posted 17 Feb 2014 Link to this post

    Same here!
    Let me know if you found something
  3. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 18 Feb 2014 Link to this post

    Hello,

    I managed to run the plugin by executing the following steps:
    1. First, I created a new blank project in AppBuilder;
    2. In it, I added the plugin from an archive (downloaded from GitHub);
    3. Next, I added the following in the iOS Config.xml:
      <feature name="SocialSharing">
        <param name="ios-package" value="SocialSharing" />
      </feature>

      and the following in the Android Config.xml:
      <feature name="SocialSharing">
        <param name="android-package" value="nl.xservices.plugins.SocialSharing"/>
      </feature>
    4. Inside the plugin.xml, I deleted the js-module:
      <js-module src="www/SocialSharing.js" name="SocialSharing">
        <clobbers target="window.plugins.socialsharing" />
      </js-module>
      and instead, I added asset to the SocialSharing.js file, like this:
      <asset src="www/SocialSharing.js" target="SocialSharing.js" />
    5. Finally, in the Index.html of the project I inserted a reference to the SocialSharing.js file:
      <script type="text/javascript" src="SocialSharing.js"></script>

      The whole Index.html:
      <!DOCTYPE html>
      <html>
          <head>
              <script type="text/javascript" src="SocialSharing.js"></script>
          </head>
          <body>
              <script>
                  if (typeof SocialSharing !== 'undefined'){
                    // plugin is available
                  alert("okay!");
                      SocialSharing.share('Message and subject', 'The subject');
                  }else{
                  alert("nope!");
                  }
              </script>
          </body>
      </html>
    6. Building and deploying the app on a device resulted with 'okay!' alert.
    I am attaching my project for your guidance.

    Regards,
    Kaloyan
    Telerik
    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)
  4. Jeelig
    Jeelig avatar
    31 posts
    Member since:
    Feb 2013

    Posted 18 Feb 2014 in reply to Kaloyan Link to this post

    Thanks. You gotta be very lucky.
    I imported the zip as a project and "bim"! "nope!"
    I created a new project followed all the instructions and still "nope!".
    Don't know what's wrong
  5. Andres
    Andres avatar
    13 posts
    Member since:
    Aug 2013

    Posted 18 Feb 2014 Link to this post

    Hi Gilles, 

    I had the same problem, my project always displays "nope!" and it was because my index.html had src="SocialSharing,js", but in telerik should be = "Plugins/SocialSharing-PhoneGap-Plugin-master/www/SocialSharing.js" if you import the plugin. Try to change this.

    Regards.
  6. Jeelig
    Jeelig avatar
    31 posts
    Member since:
    Feb 2013

    Posted 18 Feb 2014 in reply to Andres Link to this post

    Yes! It works. Kinda...
    I mean i have the "okay!" alert, but ... still unable to "share" items.
    See attached
  7. Jeelig
    Jeelig avatar
    31 posts
    Member since:
    Feb 2013

    Posted 18 Feb 2014 in reply to Jeelig Link to this post

    My bad. Cordova.js was missing.
    It works!
    Thank you
  8. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 21 Feb 2014 Link to this post

    Hi again Gilles,

    I am glad that you have found a solution working on your side.

    I want to apologize, as in my previous post I did not provide the best and recommended approach for configuring the Social Sharing plugin. I would like to do this now and it is only up to you if you wish to stick with the already working plugin, or change it.

    As the Social Sharing plugin is Cordova Plugman compatible, it is a lot easier to integrate it inside an AppBuilder project. The next steps shows this. Note, the first two steps are the same as before:
    1. First, I created a new blank project in AppBuilder;
    2. In it, I added the plugin from an archive (downloaded from GitHub);
    3. Then, without changing or adding anything else, I check if the plugin is initialized after onDeviceReady. And if so, I share a message, like this (this is code from the index.js file):
      onDeviceReady: function() {
          app.receivedEvent('deviceready');
          navigator.splashscreen.hide();
          app.shareMsg();
      },
       
      shareMsg: function() {       
          if (typeof window.plugins.socialsharing !== 'undefined'){
            // plugin is available
              alert("Social Sharing plugin is initialized!");
              window.plugins.socialsharing.share('Message and subject', 'The subject');
          }else{
          alert("Social Sharing plugin is undefined!");
          }
      },

    I have attached the new project for your guidance.

    I hope you find this useful. Please, let me know if I can be of further assistance.

    Regards,
    Kaloyan
    Telerik
    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)
  9. Robert
    Robert avatar
    16 posts
    Member since:
    Jan 2014

    Posted 07 Apr 2014 in reply to Kaloyan Link to this post

    This does not work. At all....

    Robert Earnest Lassiter
  10. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 10 Apr 2014 Link to this post

    Hello Robert,

    This is highly unfortunate for us to hear. Could you elaborate a bit more on what is not working on your side in order to help you out?

    Regards,
    Kaloyan
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  11. kavin
    kavin avatar
    2 posts
    Member since:
    May 2014

    Posted 19 May 2014 Link to this post

    Hi all ...

    Pls answer me ....

    I have trouble to send and receive push notification from my server to both android and iphone devices ......

    So please guide me for any plugin or website ......

    Thank you all........




  12. Jeelig
    Jeelig avatar
    31 posts
    Member since:
    Feb 2013

    Posted 20 May 2014 in reply to kavin Link to this post

    Hi Kavin,
    You should probably create a new subject in the forum, because the subject here was about social sharing plugin.
    Anyway, I folowed this tutorial for notifications on iOS and it works pretty nice :
    http://blogs.telerik.com/appbuilder/posts/14-01-14/let's-get-push-notifications-working-in-phonegap-and-ios
    Hope it hleps
    Cheers
  13. kavin
    kavin avatar
    2 posts
    Member since:
    May 2014

    Posted 20 May 2014 in reply to Jeelig Link to this post

    Thank U jeelig g ..............
  14. Rodney
    Rodney avatar
    5 posts
    Member since:
    Sep 2014

    Posted 21 Sep 2014 Link to this post

    This does not work for me either. I am using AppBuilder and download the latest Plugin from Telerik and import it into AppBuilder and use the JS code above and it does not recognize the JS code.

    It does seem to work if I include the JS directly in my index.html
            <script type="text/javascript" src="cordova.js"></script>
            <script type="text/javascript" src="Plugins/SocialSharing-master/www/SocialSharing.js"></script>
  15. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 24 Sep 2014 Link to this post

    Hello Rodney,

    This is strange. Normally, you should be able to import the SocialSharing plugin from the Telerik Verified Plugins Marketplace. Then, you can check the sample app, or the usages examples and see if they work as expected on you side.

    Please, do not hesitate to contact us again if there are any further issues.

    Regards,
    Kaloyan
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  16. Martin
    Martin avatar
    2 posts
    Member since:
    Jun 2015

    Posted 25 Jun 2015 in reply to Kaloyan Link to this post

    Hello,

    Does anybody know an example of a custom plugin working within the current Telerik and Cordova version? I have been trying to get custom plugins to work for a couple of days now, but nothing is working. I have followed all the steps in this forum post, but i still get the 'nope!' alert. I tried both paths to the SocialSharing.js file. 

    Thanks for your help in advance

     Regards Martin

  17. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 30 Jun 2015 Link to this post

    Hello Martin,

    If you are referring to my previous reply in this forum thread, I must say that it is a bit obsolete as now we completely depend on Plugman and all the custom Cordova plugins use js-module for including their javascript files in the project. This said, you will only need to import the custom plugins in the AppBuilder project in order to utilize their features. Here are the relevant articles for that:
     - Import custom Cordova plugins
     - Install Telerik Verified plugins

    As for examples, you can check the Telerik Verified Plugins Marketplace sample applications, as you can directly clone them inside AppBuilder.

    I hope this helps.

    Regards,
    Kaloyan
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top