Phonegap Frameworkで電子メール、Twitter、FacebookへのURLを共有する方法をプログラムする方法はありますか? Androidの例では、この機能はアプリの90%にあります。 Iphoneでは、どのアプリにもあります。 Iphoneのtechcrunchのアプリでは、あなたが記事を開いたときにそれを見ることができます。 Phonegapでこれを作成することも可能ですか?Phonegap - 電子メール、Twitter、Facebookへの機能共有
14
A
答えて
7
これはAndroidで次のプラグインのコードで行うことができます。まだどこにでも公開していませんが、最終的にAndroid用のphonegapプラグインリポジトリにプラグインとして追加したいと考えています。
JAVASCRIPT:アンドロイド、IN
var Share = function() {};
Share.prototype.show = function(content) {
return PhoneGap.exec(
function(args) {
console.log("phonegap share plugin - success!")
}, function(args) {
console.log("phonegap share plugin - failed")
}, 'Share', '', content);
};
PhoneGap.addConstructor(function() {
PhoneGap.addPlugin('share', new Share());
PluginManager.addService("Share","com.COMPANYNAME(CHANGEME).android.plugins.Share");
});
JAVA:
package com.COMPANYNAME(CHANGEME).android.plugins;
import org.json.JSONArray;
import org.json.JSONException;
import android.content.Intent;
import com.phonegap.api.Plugin;
import com.phonegap.api.PluginResult;
public class Share extends Plugin {
private String callback;
@Override
public PluginResult execute(String action, JSONArray args, String callbackId) {
PluginResult mPlugin = null;
try {
mPlugin = activateSharing(args.getString(0), args.getString(1));
} catch (JSONException e) {
Log.e("JSON Exception", e.toString());
}
mPlugin.setKeepCallback(true);
this.callback = callbackId;
return mPlugin;
}
private PluginResult activateSharing(String title, String body) {
final Intent shareIntent = new Intent(
android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, title);
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(Intent.createChooser(shareIntent, "Share"));
return new PluginResult(PluginResult.Status.OK);
}
}
4
ほぼ3年後:ここで同じAPIでAndroidとiOS上で共有できますプラグインです。 https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
これはPhoneGapでも利用できます。
例
window.plugins.socialsharing.share('Google is awesome, WOOT!', 'Google facts', 'https://www.google.com/images/srpr/logo11w.png', 'http://www.google.com');
0
プラグインappInBrowserを使用してログインし、Facebookやポストフィード、ログインTwitterやポストステータス:
関連する問題
- 1. PhoneGap/jQueryMobileを使用したFacebook/Twitter/Eメール機能の共有
- 2. BlackBerryでSMS、電子メール、twitter、facebookで共有
- 3. 電子メールを共有ホスティングにリダイレクト
- 4. 共有 - 電子メール入力フィールド
- 5. iOS用のTwitter共有写真機能
- 6. Androidの共有共有設定とユーザーのfacebookログインの電子メールを取得する4
- 7. メールとソーシャル共有の機能
- 8. Facebookの "自動"共有機能
- 9. 「共有」機能の問題Facebookファンページ
- 10. facebook twitterへの私のリンクを共有するには
- 11. Facebook、Twitterなどへのリンクを共有する方法は?
- 12. Facebook、LinkedIn、Twitter共有の問題
- 13. モバイル用FacebookとTwitterの共有
- 14. twitter、facebook、flicr、tumblrのIOS共有フレームワーク
- 15. Androidで電子メールでテキストを共有し、他のアプリでプレーンテキストを共有
- 16. アンドロイドアプリに電子メール機能を統合
- 17. HTML電子メールが機能しない:/
- 18. Perl電子メール機能Mime :: Lite
- 19. 電子メールのインラインイメージはMacOSの電子メールでは機能しません
- 20. twitterの電子メールを作成する
- 21. PHPの電子メール機能が.org電子メールで動作しない
- 22. PHPの電子メール機能が電子メールを送信しない
- 23. 電子アプリケーションの共有
- 24. FacebookやTwitterでハイスコアを共有
- 25. Google電子メールへの電子メールの送信方法
- 26. どのように共有するDeeplinking URLを電子メール
- 27. 共有機能
- 28. 共有機能
- 29. CFMAIL:一部のメールで電子メールが機能しない
- 30. iPadアプリケーションのナビゲーションバーにある共有アイコンに電子メールと印刷機能を追加します。
あなたはこのことを理解しました、のために働くの単純な解決策を探してios/phonegap(コードバー1.7) – nate8684