I am new to volt and so far loving how easy it is to use and deploy.
I don’t fully understand how to use a plugin and having trouble with it.
I am using a complete bare bones start
so i start with:
-
cordova create MyApp
-
cd MyApp
-
cordova plugin add cordova-plugin-x-socialsharing (This one is on the volt supported plug)
-
cordova platform add android
-
cordova plugin ls
cordova-plugin-x-socialsharing 6.0.3 “SocialSharing”
es6-promise-plugin 4.2.2 “Promise” -
my index.js file
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
// Cordova is now initialized. Have fun!
}
$(document).on("click", '.shareBtn', function(){
var options = {
message: "Share app",
files: ['', ''],
url: "https://developer.mozilla.org",
chooserTitle: "Share this app"
}
function socialSharing(){
window.plugins.socialsharing.shareWithOptions(options)
}
try {
socialSharing()
} catch(err) {
alert(err)
}
})
-
zip everything up to voltbuilder and get apk debug and then test on phone
-
Get error: " TypeError: Cannot read properties of undefined (reading ‘socialsharing’) "
-
my config file looks like this:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>Sample Apache Cordova App</description>
<author email="dev@cordova.apache.org" href="https://cordova.apache.org">
Apache Cordova Team
</author>
<content src="index.html" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
</widget>
Been lost for hours now.