내 애플 리케이션 (https://github.com/ParsePlatform/Parse-SDK-Android)에서 구문 분석 SDK를 사용하고 있습니다.Parse SDK 안드로이드 - 페이 스북 그래프 API v2.0
내 응용 프로그램은 또한 페이스 북 로그인 경험을 제공하기 위해 페이스 북의 Utils를 사용 (https://github.com/ParsePlatform/ParseFacebookUtils-Android)
최근내 응용 프로그램 중 하나에 대한 페이스 북 개발자에서 다음과 같은 메시지가받은 : "xxx는 최근 제작되었습니다 2016 년 8 월 8 일 월요일에 2 년 약정 중단 기간이 끝나는 Graph API v2.0에 대한 API 호출. 경험이 손상되지 않도록 모든 호출을 v2.1 이상으로 마이그레이션하십시오. "
어떻게 문제를 해결할 수 있습니까?
이것은 dependecies 섹션에서 내 build.gradle 파일입니다
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.parse:parse-android:1.13.1'
compile 'com.parse:parsefacebookutils-v4-android:[email protected]'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
compile 'com.parse.bolts:bolts-applinks:1.4.0'
compile 'com.jeremyfeinstein.slidingmenu:library:[email protected]'
compile 'com.soundcloud.android:android-crop:[email protected]'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile files('libs/universal-image-loader-1.9.3.jar')
}
이 내가 페이스 북 SDK를 사용하여 코드의 유일한 지점입니다은 :
ParseFacebookUtils.logInWithReadPermissionsInBackground(Login.this, permissions, new LogInCallback() {
@Override
public void done(final ParseUser user, ParseException err) {
fbdialog = new ProgressDialog(Login.this);
fbdialog.setTitle("Contacting Facebook");
fbdialog.setMessage("Please wait a moment. We are contacting Facebook to perform the registration");
fbdialog.show();
if (user == null) {
Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
fbdialog.cancel();
} else if (user.isNew() || !user.isNew()) {
Log.d("MyApp", "User signed up and logged in through Facebook!" + AccessToken.getCurrentAccessToken());
GraphRequest request = GraphRequest.newMeRequest(
AccessToken.getCurrentAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(
JSONObject object,
GraphResponse response) {
if(response!=null) {
try {
String nome = object.getString("name");
String email = object.getString("email");
String gender = object.getString("gender");
final String facebookid = object.getString("id");
ParseUser utente = ParseUser.getCurrentUser();
utente.put("namelastname", nome);
utente.put("email", email);
utente.put("gender", gender);
utente.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("idutente", user);
installation.saveInBackground();
//downloading the user profile image from facebook
AsyncTaskLoad as = new AsyncTaskLoad();
as.execute("https://graph.facebook.com/" + facebookid + "/picture?type=large");
fbdialog.cancel();
} else {
fbdialog.cancel();
e.printStackTrace();
}
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,link,email,age_range,gender,birthday");
request.setParameters(parameters);
request.executeAsync();
} else {
Log.d("MyApp", "User logged in through Facebook!");
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("idutente", user);
installation.saveInBackground();
fbdialog.cancel();
//here I start a new activity
}
}
});
}
});
이 사용되는 AsyncTask를하다 Facebook 프로필 이미지를 다운로드하려면
private class AsyncTaskLoad extends AsyncTask<String, Void, Void> {
@Override
protected void onPreExecute() {
pd = new ProgressDialog(Login.this);
pd.setTitle("Logging");
pd.show();
}
@Override
protected Void doInBackground(String... strings) {
try {
URL image_value = new URL(strings[0]);
SynchroHelper sync = new SynchroHelper(Login.this);
//simple http method to download an image and save it into a file in the external storage dir
sync.downloadImage(image_value.toString(), "myprof.jpg", Environment.getExternalStorageDirectory());
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void params) {
//starting a new activity...
pd.dismiss();
}
}
어떻게 Graph API v2.0으로 업그레이드 할 수 있습니까? Parse-SDK의 업데이트를 기다려야합니까?
나는 또한이 이메일을 받았는데, 어떻게 해결해야할지 모르겠다. – Josh