Facebook - 代理的应用程序尚未安装

时间:2014-07-14 06:43:23

标签: android facebook

我正在开发一款需要登录facebook的Android应用。但是当我尝试登录时,我不断收到错误消息:代理应用程序尚未安装

我只要求电子邮件许可。没有要求发布权限。

以下是我的代码:

package com.zootr.matchup;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.facebook.HttpMethod;
import com.facebook.Response;
import com.facebook.Session;
import com.facebook.SessionLoginBehavior;
import com.facebook.SessionState;
import com.facebook.Settings;
import com.facebook.UiLifecycleHelper;
import com.facebook.model.GraphUser;
import com.facebook.widget.LoginButton;
import com.facebook.Request;
import com.zootr.matchup.task.singup.SignUpDelegate;
import com.zootr.matchup.task.singup.SignUpManager;
import com.zootr.matchup.utils.Utils;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import zootr.matchup.cricket.R;

public class MainFragment extends Fragment {

private static final String TAG = "MainFragment";
private SignUpManager signUpManager;
private MainActivity activity;
private UiLifecycleHelper uiHelper;
private String profileName;
private String user_ID;
private String user_email;
private String user_location=null;
private String image_url;
private String gender;
private SignUpDelegate delegate;
private LoginButton authButton;
public void init(SignUpDelegate delegate, MainActivity activity)
{
    this.delegate = delegate;
    this.activity = activity;
}
@Override
public View onCreateView(LayoutInflater inflater, 
        ViewGroup container, 
        Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.main, container, false);
    authButton = (LoginButton) view.findViewById(R.id.authButton);
    authButton.setFragment(this);
    authButton.setReadPermissions(Arrays.asList("email"));
    activity.authButton = authButton;
    Utils.saveData("fbStateLoggedIn", false);
    Session session = Session.getActiveSession();
    if ((session != null && session.isOpened()) || Utils.getData("logged in", false)) {
        authButton.setVisibility(View.GONE);            
        onSessionStateChange(session, session.getState(), null);
    }

    return view;
}

private void onSessionStateChange(final Session session, SessionState state, Exception exception) {
    Log.i(TAG, "hey");
    try{
        if (state.isOpened()) {
            Log.i(TAG, "Logged in..."); 
            Utils.saveData("sign-in-type", "facebook");

            final Bundle params = new Bundle();
            params.putBoolean("redirect", false);
            params.putString("height", "200");
            params.putString("type", "large");
            params.putString("width", "200");
            Request.newMeRequest(session, new Request.GraphUserCallback() {
                @Override
                public void onCompleted(GraphUser user, Response response) {
                    if (user != null) {

                        user_ID = user.getId();//user id
                        profileName = user.getName();//user's profile name
                        user_email = (String) user.asMap().get("email");  
                        gender = user.asMap().get("gender").toString();
                        new Request(session,"/me/picture",params,HttpMethod.GET,new Request.Callback() {
                            public void onCompleted(Response response) {
                                try {
                                    image_url = response.getGraphObject().getInnerJSONObject().getJSONObject("data").getString("url");
                                    if(signUpManager == null){
                                        signUpManager = new SignUpManager(getActivity());
                                    }
                                    activity.findViewById(R.id.waiting).setVisibility(View.VISIBLE);
                                    activity.findViewById(R.id.email_login).setVisibility(View.GONE);
                                    activity.findViewById(R.id.btn_sign_in).setVisibility(View.GONE);                                   
                                    authButton.setVisibility(View.GONE);
                                    signUpManager.signupPlayerProfile(Utils.getData("zootr_id", 0),
                                            "",user_ID, profileName,  user_email, gender, image_url, user_location , "0", delegate);                                    
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                Utils.saveData("fbid", user_ID);
                                Utils.saveData("fb_image", image_url);
                                Utils.saveData("fb_name", profileName);
                            }
                        }
                                ).executeAsync();

                    }


                }
            }).executeAsync();
        }

        else if (state.isClosed()) {
            Log.i(TAG, "Logged out...");
        } 
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }


}

private Session.StatusCallback callback = new Session.StatusCallback() {
    @Override
    public void call(Session session, SessionState state, Exception exception) {
        Log.i(TAG, "hey1");
        Log.i(TAG,state.toString());
        Log.i(TAG,session.getAccessToken());
        onSessionStateChange(session, state, exception);
    }
};

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    uiHelper = new UiLifecycleHelper(getActivity(), callback);
    uiHelper.onCreate(savedInstanceState);

}   


@Override
public void onResume() {
    super.onResume();
    uiHelper.onResume();

}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {        
    Log.i(TAG, "hey2");
    super.onActivityResult(requestCode, resultCode, data);
    uiHelper.onActivityResult(requestCode, resultCode, data);
    Utils.saveData("fbStateLoggedIn", true);
}


@Override
public void onPause() {
    super.onPause();
    uiHelper.onPause();
}

@Override
public void onDestroy() {
    super.onDestroy();
    uiHelper.onDestroy();
}

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    uiHelper.onSaveInstanceState(outState);
}


 }

以下是我的LogCat:

 07-14 11:55:21.380: W/PackageManager(1753): Unknown permission        com.facebook.pages.app.provider.ACCESS in package com.facebook.katana
  07-14 11:55:21.380: W/PackageManager(1753): Unknown permission com.amazon.device.messaging.permission.RECEIVE in package com.facebook.katana
  07-14 11:55:21.380: W/PackageManager(1753): Unknown permission android.permission.READ_PROFILE in package com.facebook.katana
  07-14 11:55:21.380: W/PackageManager(1753): Unknown permission android.permission.READ_EXTERNAL_STORAGE in package com.facebook.katana
  07-14 11:55:21.380: W/PackageManager(1753): Unknown permission com.htc.launcher.permission.READ_SETTINGS in package com.facebook.katana
  07-14 11:55:21.380: W/PackageManager(1753): Unknown permission com.htc.launcher.permission.UPDATE_SHORTCUT in package com.facebook.katana
  07-14 11:55:21.380: W/PackageManager(1753): Unknown permission com.sonyericsson.home.permission.BROADCAST_BADGE in package com.facebook.katana
  07-14 11:55:21.380: W/PackageManager(1753): Unknown permission com.facebook.home.permission.WRITE_BADGES in package com.facebook.katana
  07-14 11:55:21.380: W/PackageManager(1753): Unknown permission com.nokia.pushnotifications.permission.RECEIVE in package com.facebook.katana
  07-14 11:55:21.410: W/PackageManager(1753): Unknown permission android.permission.READ_PROFILE in package com.facebook.orca
  07-14 11:55:21.410: W/PackageManager(1753): Unknown permission android.permission.READ_EXTERNAL_STORAGE in package com.facebook.orca
  07-14 11:55:21.410: W/PackageManager(1753): Unknown permission com.htc.launcher.permission.READ_SETTINGS in package com.facebook.orca
  07-14 11:55:21.410: W/PackageManager(1753): Unknown permission com.htc.launcher.permission.UPDATE_SHORTCUT in package com.facebook.orca
  07-14 11:55:21.410: W/PackageManager(1753): Unknown permission com.sonyericsson.home.permission.BROADCAST_BADGE in package com.facebook.orca
  07-14 11:55:21.410: W/PackageManager(1753): Unknown permission com.facebook.home.permission.WRITE_BADGES in package com.facebook.orca
  07-14 11:55:21.410: W/PackageManager(1753): Unknown permission com.nokia.pushnotifications.permission.RECEIVE in package com.facebook.orca
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790): com.facebook.http.protocol.ApiException: The proxied app is not already installed.
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:86)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:165)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.protocol.ApiResponse.g(ApiResponse.java:151)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.platform.auth.server.AuthorizeAppMethod.a(AuthorizeAppMethod.java:275)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.platform.auth.server.AuthorizeAppMethod.a(AuthorizeAppMethod.java:31)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.protocol.ApiResponseHandler.a(ApiResponseHandler.java:59)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.protocol.ApiResponseHandler.handleResponse(ApiResponseHandler.java:31)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:312)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:142)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.common.FbHttpRequestProcessor.b(FbHttpRequestProcessor.java:98)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:228)
  07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):   at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:415)
   07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):  at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:170)
   07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):  at com.facebook.http.protocol.AbstractSingleMethodRunner.a(AbstractSingleMethodRunner.java:18)
   07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):  at com.facebook.platform.common.server.SimplePlatformOperation.a(SimplePlatformOperation.java:40)
   07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):  at com.facebook.platform.common.server.PlatformOperationHandler.a(PlatformOperationHandler.java:60)
   07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):  at com.facebook.fbservice.service.BlueServiceQueue.e(BlueServiceQueue.java:345)
   07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):  at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:56)
   07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):  at com.facebook.fbservice.service.BlueServiceQueue$3.run(BlueServiceQueue.java:265)
   07-14 11:58:25.379: W/fb4a(:<default>):BlueServiceQueue(12790):  at com.facebook.common.executors.ListenableScheduledFutureImpl.run(ListenableScheduledFutureImpl.java:59)

0 个答案:

没有答案