问题描述
我已成功地喜欢非Facebook的网页,但是当我尝试点击喜欢Facebook的之一,采用OpenGraph,我得到:类似的行动尚不支持对这种类型的对象。
I have managed to "Like" a non-Facebook webpage, but when I try Liking a Facebook one, using OpenGraph, I get:Like actions are not yet supported against objects of this type.
有没有办法使用Android SDK的Facebook,没有使用喜欢一个Facebook页面的WebView
Is there any way to like a Facebook page using the Android Facebook SDK, not using a WebView
?
推荐答案
我假定你在Facebook的开发者网站开发应用程序的知识。
让您的应用程序ID和粘贴标识字符串资源。
I assumes you have knowledge of developing app in facebook developer site.get your app id and paste id String resources.
XXXXXXXXXXXXXX
xxxxxxxxxxxxxx
改变你的清单。
/////////////////////////////// Activity_main /////////////// /////
///////////////////////////////Activity_main////////////////////
<com.facebook.widget.LikeView
android:id="@+id/like_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
facebook:confirm_logout="false"
facebook:fetch_user_info="true" />
/////////////////////////////////////////////主要活动//////////////////
/////////////////////////////////////////////Main Activity//////////////////
package com.example.loginfacebook;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.facebook.widget.LikeView;
public class MainActivity extends FragmentActivity {
private LikeView like;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
like = (LikeView) findViewById(R.id.like_view);
like.setObjectId("https://www.facebook.com/appbellfitness");
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//uiHelper.onActivityResult(requestCode, resultCode, data);
LikeView.handleOnActivityResult(getApplicationContext(), requestCode, resultCode, data);
}
}
这就是它...
注意(Facebook的多年平均值直接让像原生的Android按钮点击的页面。)
thats it...note(facebook doesnot allow directly like a page on native android button click.)
这篇关于如何像Android上的Facebook页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!