Android and Facebook share intent

前端 未结 12 2233
闹比i
闹比i 2020-11-22 13:02

I\'m developing an Android app and am interested to know how you can update the app user\'s status from within the app using Android\'s share intents.

Having looked

12条回答
  •  余生分开走
    2020-11-22 13:48

    The easiest way that I could find to pass a message from my app to facebook was programmatically copy to the clipboard and alert the user that they have the option to paste. It saves the user from manually doing it; my app is not pasting but the user might.

    ...
    if (app.equals("facebook")) {
        // overcome fb 'putExtra' constraint;
        // copy message to clipboard for user to paste into fb.
        ClipboardManager cb = (ClipboardManager) 
                getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clip = ClipData.newPlainText("post", msg);
        cb.setPrimaryClip(clip);
    
        // tell the to PASTE POST with option to stop showing this dialogue
        showDialog(this, getString(R.string.facebook_post));
    }
    startActivity(appIntent);
    ...
    

提交回复
热议问题