PhoneGap的安卓2.0或更高版本的共享插件Facebook的任何更新,微博,邮件等 [英] Android Phonegap version 2.0 or higher any update for Share plugin for facebook , twitter, message etc

查看:118
本文介绍了PhoneGap的安卓2.0或更高版本的共享插件Facebook的任何更新,微博,邮件等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PhoneGap的分享插件了解2.0版本。我已经实现了它但这不能正常工作。

I am trying to use the PhoneGap Share plugin for 2.0 version. I have implemented it but this is not work properly.

该插件是用PhoneGap的1.0和更高版本的任何新的或更新的插件在Facebook上共享信息。

This plugin is written in PhoneGap 1.0 and later version any new or updated plugin for share message on Facebook.

我已经提到这个<一个href="http://tech.sarathdr.com/featured/social-share-plugin-for-android-cordova-2-2-0-email-sms-facebook-twitter-share"相对=nofollow>文档这个问题:<一href="http://stackoverflow.com/questions/13218709/how-to-implement-facebook-send-twitter-share-send-sms-send-email-in-my-phoneg">How实行Facebook发送,微博分享,发送短信,在我的PhoneGap的Andr​​oid应用程序发送电子邮件?

I've referred to this documentation and this question: How to implement facebook send, twitter share, send sms, send email in my phonegap android application?

但仍然没有得到妥善的解决办法。

But still not getting proper solution.

推荐答案

我分享我的code这是工作的罚款。 请参阅这对于共享插件功能链接,并按照如下步骤。

I am sharing my code which is working fine. Please refer This link for share plugin functionality and follow below given steps.

1放入MainActivity.java文件夹中的同一个文件夹中的JS文件。

1- Place the JS file in the same folder of the MainActivity.java folder.

2-放置在WWW文件夹JS文件,并将其添加到index.html夹

2- Place the Js file in the www folder and add it to the index.html folder.

3中添加以下行到config.xml(如果您使用的是新版本的PhoneGap的)或plugins.xml(对于旧版本的PhoneGap的):

3- Add the following line to the config.xml (if you are using new version of Phonegap) or plugins.xml (for old version of Phonegap):

4 - 添加HTML

4 - add html

    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript" src="js/libs/cordova-2.0.0.js"></script>
    <script type="text/javascript" src="js/libs/jq_min.js"></script>
    <script src="js/libs/share.js">
    </script>
    <script>
        // Wait for Cordova to load
        //
        document.addEventListener("deviceready", onDeviceReady, false);

        // Cordova is ready
        //
        function onDeviceReady() {

        }

        //share plugin for update status  
        function share(subject, text) { 
        window.plugins.share.show({
        subject: subject,
        text: text},
        function() {
        alert("sent success");}, // Success function
        function() {alert('Share failed')} // Failure function
         );
        };

        //Send message on facebook
        $(document).ready(function() {
        $("button#sendFacebook").click(function(){
        var txtsub = $("input#txtsub").attr("value");
        var txtmsg = $("#txtmsg").val();
        share(txtsub, txtmsg);
    });

    });
    </script>
    </head>

    <body>
    <input id="txtsub" type="text" placeholder="Enter Subject" maxlength="20" required /><br/><br/>

    <textarea placeholder="Enter Message" id="txtmsg" rows="4" cols="25"></textarea><br/>
    <button id="sendFacebook">Update Status </button>


    </body>
    </html>

和测试该插件脸书,微博,Gmail会等。 &放大器;享受 :)。

and test this plugin for Face book,twitter,gmail etc. & enjoy :).

让我知道如果您有任何疑问。

Let me know if you have any query.

这篇关于PhoneGap的安卓2.0或更高版本的共享插件Facebook的任何更新,微博,邮件等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆