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
16 Answers, 1 is accepted
Let me know if you found something
I managed to run the plugin by executing the following steps:
- First, I created a new blank project in AppBuilder;
- In it, I added the plugin from an archive (downloaded from GitHub);
- 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
>
- Inside the plugin.xml, I deleted the js-module:
<
js-module
src
=
"www/SocialSharing.js"
name
=
"SocialSharing"
>
<
clobbers
target
=
"window.plugins.socialsharing"
/>
</
js-module
>
<
asset
src
=
"www/SocialSharing.js"
target
=
"SocialSharing.js"
/>
- 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
>
- Building and deploying the app on a device resulted with 'okay!' alert.
Regards,
Kaloyan
Telerik
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
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.
It works!
Thank you
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:
- First, I created a new blank project in AppBuilder;
- In it, I added the plugin from an archive (downloaded from GitHub);
- 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
Robert Earnest Lassiter
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!
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........
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
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>
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.
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
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.