내 안드로이드 프로젝트에 페이스 북 SDK를 구현했습니다. 사용자의 타임 라인에 새 메시지를 게시해야하는 공유 버튼을 사용하고 있습니다. 모든 기능이 작동합니다.하지만 휴대 전화에 Facebook 앱을 설치하지 않고도 앱을 사용해보고 싶었습니다.Strange android-facebook share button
페이스 북을 제거하고, 캐시를 비우고, 모든 데이터를 지우고, 설정에서 "Facebook 계정"을 제거하고 전화를 다시 시작했습니다. 그 후, 내 응용 프로그램에서 공유 버튼을 누르면 게시물이 내 타임 라인에있었습니다! 이것이 어떻게 가능할까요? 나는 모든 것을 제거했다!
이것은 코드입니다. 이것이 뭔가 도움이되는지 나는 모른다.
화재 everyting
@Override
public void onClick(View v)
{
switch(v.getId())
{
case R.id.btnFacebook:
Session.openActiveSession(this, true, new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()){
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null){
publishStory();
}
}
});
}
}
});
break;
}
}
private void publishStory() {
Session session = Session.getActiveSession();
if (session != null){
// Check for publish permissions
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS, permissions)) {
Session.NewPermissionsRequest newPermissionsRequest = new Session
.NewPermissionsRequest(this, PERMISSIONS);
session.requestNewPublishPermissions(newPermissionsRequest);
return;
}
Bundle postParams = new Bundle();
postParams.putString("name", "Something...");
postParams.putString("caption", "My caption...");
postParams.putString("description", "Awesomedescription");
postParams.putString("link", "http://www.domain.com");
postParams.putString("picture", "http://www.domain.com/image.png");
Request.Callback callback= new Request.Callback() {
public void onCompleted(Response response) {
JSONObject graphResponse = response
.getGraphObject()
.getInnerJSONObject();
String postId = null;
try {
postId = graphResponse.getString("id");
Log.i("DEB", " SUCCESS POSTED TIMELINE ! ");
} catch (JSONException e) {}
FacebookRequestError error = response.getError();
if (error != null) {
} else {
Toast.makeText(getApplicationContext(),
postId,
Toast.LENGTH_LONG).show();
}
}
};
Request request = new Request(session, "me/feed", postParams,
HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}
}
private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
for (String string : subset) {
if (!superset.contains(string)) {
return false;
}
}
return true;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}
페이스 북 사이트에서 앱을 삭제 했습니까? 개인 정보 보호 설정 -> 앱 -> 사용중인 앱? – sromku