Android 如何在登录过程中获取dropbox帐户的电子邮件?

Android 如何在登录过程中获取dropbox帐户的电子邮件?,android,dropbox,Android,Dropbox,我使用“dropbox-android-sdk-1.6.1.jar”并尝试获取电子邮件: AndroidAuthSession session = buildSession(); mApi = new DropboxAPI<AndroidAuthSession>(session); mApi.getSession().startOAuth2Authentication(myactivity.this); 如何让电子邮件用户使用dropboxAPI进行身份验证? 谢谢你的答复。谢

我使用“dropbox-android-sdk-1.6.1.jar”并尝试获取电子邮件:

AndroidAuthSession session = buildSession();
mApi = new DropboxAPI<AndroidAuthSession>(session);


mApi.getSession().startOAuth2Authentication(myactivity.this);
如何让电子邮件用户使用dropboxAPI进行身份验证?
谢谢你的答复。谢谢

我使用反射来获取包含电子邮件信息的JSONObject

public static JSONObject getJson(DbxAccountInfo info) {
    Class<?> accountClass;
    Field rawJson = null;
    try {
        accountClass = Class.forName(info.getClass().getName());
        rawJson = accountClass.getDeclaredField("rawJson");
    } catch (ClassNotFoundException e1) {
        Log.d("myLogs", e1.getMessage() + " exception");
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    }
    rawJson.setAccessible(true);
    JSONObject json = null;
    try {
        json = new JSONObject((String)rawJson.get(info));
    } catch (IllegalAccessException e2) {
        e2.printStackTrace();
    } catch (IllegalArgumentException e2) {
        e2.printStackTrace();
    } catch (JSONException e2) {
        e2.printStackTrace();
    }
    return json;
}
publicstaticjsonobjectgetjson(DbxAccountInfo){
类accountClass;
字段rawJson=null;
试一试{
accountClass=Class.forName(info.getClass().getName());
rawJson=accountClass.getDeclaredField(“rawJson”);
}捕获(ClassNotFoundException e1){
Log.d(“myLogs”,e1.getMessage()+“异常”);
}捕获(无此字段例外){
e、 printStackTrace();
}
setAccessible(true);
JSONObject json=null;
试一试{
json=newJSONObject((字符串)rawJson.get(信息));
}捕获(非法访问异常e2){
e2.printStackTrace();
}捕获(IllegalArgumentException e2){
e2.printStackTrace();
}捕获(JSONException e2){
e2.printStackTrace();
}
返回json;
}

不适用于当前的Dropbox Android API,我得到了一个
NoSuchFieldException
。还有别的想法吗?
public static JSONObject getJson(DbxAccountInfo info) {
    Class<?> accountClass;
    Field rawJson = null;
    try {
        accountClass = Class.forName(info.getClass().getName());
        rawJson = accountClass.getDeclaredField("rawJson");
    } catch (ClassNotFoundException e1) {
        Log.d("myLogs", e1.getMessage() + " exception");
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    }
    rawJson.setAccessible(true);
    JSONObject json = null;
    try {
        json = new JSONObject((String)rawJson.get(info));
    } catch (IllegalAccessException e2) {
        e2.printStackTrace();
    } catch (IllegalArgumentException e2) {
        e2.printStackTrace();
    } catch (JSONException e2) {
        e2.printStackTrace();
    }
    return json;
}