0

I Build My App, so need to use social sharing... i tried :

androidmanifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

config.xml

<gap:plugin name="nl.x-services.plugins.socialsharing" />

<feature name="SocialSharing">
    <param name="android-package" value="nl.xservices.plugins.SocialSharing" />
</feature>

download zip sample file and copy SocialSharing.js to 'js' directory

and also:

<p id="placeholder2" class="calculatePlace" onclick="shareMe()"></p>

share me function:

function shareMe(){
    console.log('Index.html >> Sharing ...');
    window.plugins.socialsharing.share('Test Share', null, null, 'http://google.com');

// window.plugins.socialsharing.share('Share Text'); }

and copy file "SocialSharing.java" into "project_directory\src\nl\xservices\plugins"

and logcat shows me:

04-06 17:11:35.953  20095-20095/com.emaarit.app.sample V/webview﹕ singleCursorHandlerTouchEvent -getEditableSupport  FASLE
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample D/CordovaLog﹕ file:///android_asset/www/index.html: Line 30 : Index.html >> Sharing ...
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample I/Web Console﹕ Index.html >> Sharing ... at file:///android_asset/www/index.html:30
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample D/CordovaLog﹕ file:///android_asset/www/index.html: Line 31 : Uncaught TypeError: Cannot read property 'socialsharing' of undefined
04-06 17:11:36.273  20095-20095/com.emaarit.app.sample E/Web Console﹕ Uncaught TypeError: Cannot read property 'socialsharing' of undefined at file:///android_asset/www/index.html:31

when i want to install plugin, run 'node.js command prompt' (Windows 7) as administrator and type the following command:

npm install -d cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

it shows me error:

npm info it worked if it ends with ok
npm info using npm@1.4.23
npm info using node@v0.10.31
npm info retry fetch attempt 1 at 16:15:35
npm http GET https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/plugin
npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/cordova
npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/add
npm http 304 https://registry.npmjs.org/cordova
npm http 304 https://registry.npmjs.org/add
npm http 304 https://registry.npmjs.org/plugin
npm http 200 https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

npm ERR! not a package C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-PenpyXjc
\github.com\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git
npm ERR! Error: ENOENT, open 'C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-P
enpyXjc\github.com\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git-unpack\packa
ge.json'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-d" "cordova" "plugin" "add"
 "https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git"
npm ERR! cwd C:\Users\user7.EMIT
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-PenpyXjc\github.c
om\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git-unpack\package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\user7.EMIT\npm-debug.log
npm ERR! not ok code 0

how to solve it?

Hossein Kurd
  • 3,184
  • 3
  • 41
  • 71
  • Right now you are calling the plugin using `window.plugins.socialsharing`. I'm curious if calling `window.socialsharing` would work? – KJ Price Apr 06 '15 at 12:58
  • Error Egain And When Hold ctrl And Click On 'socialsharing' Do Not Open This File 04-06 17:41:43.757 22253-22253/com.emaarit.app.sample D/CordovaLog﹕ file:///android_asset/www/index.html: Line 31 : Uncaught TypeError: Cannot call method 'share' of undefined 04-06 17:41:43.757 22253-22253/com.emaarit.app.sample E/Web Console﹕ Uncaught TypeError: Cannot call method 'share' of undefined at file:///android_asset/www/index.html:31 – Hossein Kurd Apr 06 '15 at 13:12
  • In regards to your node error, `plugin add` is a cordova command. You run it simply as `cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git`. Get this plugin properly installed and then see if the plugin is still undefined. – laughingpine Apr 06 '15 at 16:37
  • the command "cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git" not working, because node.js shows : Current working directory is not a Cordova-based project. – Hossein Kurd Apr 07 '15 at 04:13
  • then go to your cordova project folder – jcesarmobile Apr 07 '15 at 07:43
  • @jcesarmobile i did it, nothing ... – Hossein Kurd Apr 08 '15 at 04:26
  • is your project a cordova project? how did you create it? – jcesarmobile Apr 08 '15 at 06:02
  • @jcesarmobile commandline , dir : e:\cordova-2.9.1\cordova-android\bin , create projectName com.packagename.projectname – Hossein Kurd Apr 08 '15 at 07:14
  • You are using a very old version of phonegap, you should use the latest. Cordova 2.9.1 apps won't be accepted on google play for security reasons. – jcesarmobile Apr 08 '15 at 07:26
  • thank you,so after update it will be resolve ? – Hossein Kurd Apr 08 '15 at 07:37
  • yes, when you have a cordova project with cordova 3.X.X you will be able to install plugins from the CLI, with cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git – jcesarmobile Apr 08 '15 at 14:30
  • I have updated cordova from link : https://archive.apache.org/dist/cordova/cordova-3.4.0-src.zip and replaced on older version now version is 3.4.0 but it shows me error yet – Hossein Kurd Apr 12 '15 at 05:27

0 Answers0