我构建我的应用程序,所以需要使用社交共享... 我试过了:
的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>
下载zip sample file并将SocialSharing.js复制到&#39; js&#39;目录
还有:
<p id="placeholder2" class="calculatePlace" onclick="shareMe()"></p>
分享我的功能:
function shareMe(){
console.log('Index.html >> Sharing ...');
window.plugins.socialsharing.share('Test Share', null, null, 'http://google.com');
// window.plugins.socialsharing.share(&#39; Share Text&#39;); }
并复制文件&#34; SocialSharing.java&#34;进入&#34; project_directory \ src \ nl \ xservices \ plugins&#34;
和logcat告诉我:
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
当我想安装插件时,运行&#39; node.js命令提示符&#39; (Windows 7)作为管理员并键入以下命令:
npm install -d cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git
它显示了我的错误:
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
如何解决?