12

Uygulamamda Parse SDK kullanıyorum (https://github.com/ParsePlatform/Parse-SDK-Android).Ayrıştırma SDK Android - Facebook Graph API v2.0

My uygulama aynı zamanda Facebook ile oturum açma deneyimi sağlamak için Facebook Utils kullanır (https://github.com/ParsePlatform/ParseFacebookUtils-Android)

Son zamanlarda

benim app birini ilgilendiren Facebook Geliştiriciler şu mesajı aldık: "xxx son yapıyor API, 8 Ağustos 2016 Pazartesi günü 2 yıllık kullanımdan kaldırılma penceresinin sonuna ulaşacak olan Grafik API'sı v2.0'ı çağırıyor. Lütfen olası tüm olası deneyimleri önlemek için tüm çağrıları v2.1 veya daha yüksek bir sürüme geçirin. "

Bu sorunu nasıl düzeltebilirim?

Bu dependecies bölümünde benim build.gradle dosyasıdır:

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') 

} 

ve bu Facebook SDK kullanmak kodunda sadece nokta:

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 

        } 
       } 
      }); 

     } 

    });  

kullandı AsyncTask olduğunu Facebook profil resmi karşıdan yüklemek için:

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(); 

    } 

} 

Nasıl Grafik API v2.0 sürümüne yükseltebilirim? Parse-SDK'dan bir güncelleme beklemeli miyim?

+0

Bu e-postayı da aldım, nasıl düzelteceğimi bilmiyorum. – Josh

cevap

2

Bir böcek gibi görünüyor vs. ardından v2.1, v2.2 olacak. Bir bug report dolduruldu ve şu anda araştırılıyor.

2

fb docs'dan. seni o kadar Grafik sürümünü belirtin, kodunuzu görmüyorum:

bir sürümsüz çağrı API en eski mevcut sürümü varsayılan. Sürümsüz bir arama, her zaman grafiğin en üstünde bulunan en eski sürüme işaret eder. Bu şu anda v2.0, ancak iki yıl sonra İşte

daha inforamtion sahip yaklaşık graph version