2

在我的应用程序中,我正在使用 Facebook 集成,但无法找到我应该使用多少检查/权限。我刚刚写了一些代码,但无法找到所有媒体权限和“添加权限”或“应用程序权限”

private void checkPermissions()
{
    ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
    ApplicationPermissions original = apm.getApplicationPermissions();

    if ((original.getPermission(ApplicationPermissions.PERMISSION_MEDIA) == ApplicationPermissions.VALUE_ALLOW) &&
        (original.getPermission(ApplicationPermissions.PERMISSION_LOCATION_DATA) == ApplicationPermissions.VALUE_ALLOW) &&
        (original.getPermission(ApplicationPermissions.PERMISSION_RECORDING) == ApplicationPermissions.VALUE_ALLOW) &&
        (original.getPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION) == ApplicationPermissions.VALUE_ALLOW) &&
        (original.getPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS) == ApplicationPermissions.VALUE_ALLOW) &&
        (original.getPermission(ApplicationPermissions.PERMISSION_CROSS_APPLICATION_COMMUNICATION) == ApplicationPermissions.VALUE_ALLOW) &&
        (original.getPermission(ApplicationPermissions.PERMISSION_INTERNET) == ApplicationPermissions.VALUE_ALLOW) &&
        (original.getPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK) == ApplicationPermissions.VALUE_ALLOW) &&
        (original.getPermission(ApplicationPermissions.PERMISSION_EMAIL) == ApplicationPermissions.VALUE_ALLOW)) 
    {
        return;
    }
}
4

2 回答 2

2

您必须在您的应用程序中使用这些不同类型的权限,这可以解决您的问题

  ApplicationPermissions permRequest = new ApplicationPermissions();
  permRequest.addPermission(ApplicationPermissions.PERMISSION_MEDIA);
  permRequest.addPermission(ApplicationPermissions.PERMISSION_LOCATION_DATA);
  permRequest.addPermission(ApplicationPermissions.PERMISSION_RECORDING);
  permRequest.addPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION);
  permRequest.addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);
  permRequest.addPermission(ApplicationPermissions.PERMISSION_CROSS_APPLICATION_COMMUNICATION);

  permRequest.addPermission(ApplicationPermissions.PERMISSION_INTERNET);
  permRequest.addPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK);
  permRequest.addPermission(ApplicationPermissions.PERMISSION_EMAIL);
于 2013-06-12T19:57:47.303 回答
0

以这种方式尝试:

String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
String APPLICATION_ID = "xxxxxxxx";
String APPLICATION_SECRET = "xxxxxxxxx";
String[] PERMISSIONS = Facebook.Permissions.USER_DATA_PERMISSIONS;

ApplicationSettings as = null;
Facebook fb = null;

在构造函数中获取如下实例:

    as = new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, PERMISSIONS);
    fb = Facebook.getInstance(as);

现在,您可以根据需要使用这个 fb 对象。

而且我也像上面一样集成。从未使用过您在问题中提到的权限。希望这些不是必需的。

谢谢。

于 2013-06-12T20:03:33.357 回答