私のAndroidアプリでは、ユーザーが自分のアプリをウォールで「共有」するようにしたいので、事前定義されたコンテンツステータスをウォールに投稿してもらいたいと思います。
壁のステータスをカスタマイズするにはどうすればよいですか?(アプリアイコンとフレアテキストを追加したい)。
私のAndroidアプリでは、ユーザーが自分のアプリをウォールで「共有」するようにしたいので、事前定義されたコンテンツステータスをウォールに投稿してもらいたいと思います。
壁のステータスをカスタマイズするにはどうすればよいですか?(アプリアイコンとフレアテキストを追加したい)。
Facebook SDK をダウンロードして、プロジェクトにインポートします。次に、次のコードを使用して認証します。
public void sendtoFacebook(){
facebookClient = new Facebook("<Your_APP_ID");
facebookClient.authorize(<Current_class>.this, new AuthorizeListener());
}
次に、次のメソッドを追加する必要があります。
class AuthorizeListener implements DialogListener {
public void onComplete(Bundle values) {
Bundle parameters = new Bundle();
parameters.putString("message", "<Message_you_want_to_send>");// the message to post to the wall
facebookClient.dialog(<Current_class>.this, "stream.publish", parameters, this);// "stream.publish" is an API call
}
@Override
public void onFacebookError(FacebookError e) {
}
@Override
public void onError(DialogError e) {
}
@Override
public void onCancel() {
}
}
アプリケーション名とアイコンが自動的に追加されます:)
Facebook API を学んだ後、このページに出会いました
これで、バンドル パラメーターのすべてのオプションがわかりました。助けてくれてありがとう!
これは、FacebookSDKを使用してFacebookダイアログを介してコンテンツを設定するためのバンドルを作成する方法です。
Bundle parameters = new Bundle();
parameters.putString("app_id", "xxxxxxx");
parameters.putString("link", "https://play.google.com/store/apps/details?id=myappistasty");
parameters.putString("name", "This is the name of the link set in app.");
parameters.putString("caption", "This is Text that is specified in bt the aoo");
parameters.putString("picture", "www.urltoimage.com);
facebook.dialog(MainActivity.this, "feed", parameters, new DialogListener() {
etc...
http://developers.facebook.com/docs/reference/dialogs/feed/ これは私にすべてを説明したリンクですが、Javaにはありませんが、表から良いアイデアが得られます。
また、共有 URL を介して、SDK なしでそれを行うこともできます。
public void shareOnFacebook(View v) {
Uri uri = Uri.parse("http://m.facebook.com/sharer.php?u=http://yourdomain/page.html&t=YourMessage");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
サーバーのどこかに、共有者に提供した URL の下にコンテンツ ページ/html を配置するだけです。
共有メッセージに特定の画像を表示したい場合は、共有しているサーバー上の HTML ページのメタ タグにこれを挿入します。
<link rel="image_src" type="image/jpeg" href="http://yourdomain.com/promo/image.png" />
このようなプロモーション ページのサンプルとリンクされた画像を参照してください: http://www.modelme.co.uk/promo/amandaharrington