2014-02-09 152 views
0

我想從谷歌帳戶獲取用戶信息。 我指的是this doc。我面臨的問題,在進口import com.google.android.gms.plus.model.people.Person;從Android的谷歌帳戶獲取用戶信息

但它顯示錯誤The method getCurrentPerson() is undefined for the type PlusClient

代碼

import com.google.android.gms.plus.model.people.Person; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    mPlusClient = new PlusClient.Builder(this, this, this) 
     .setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity") 
     .build(); 
} 
.......................................... 

對於獲取用戶數據的代碼,我已經使用

Person currentPerson = mPlusClient.getCurrentPerson(); 
disp_name = currentPerson.getDisplayName(); 
disp_url = currentPerson.getUrl(); 
disp_id = currentPerson.getId(); 
name.setText(disp_name); 
url.setText(disp_url); 
id.setText(disp_id); 

在manifest.xml文件我也遇到一個錯誤,顯示

Error: No resource found that matches the given name (at 'value' with value '@integer/ 
google_play_services_version') 
以下行

<meta-data 
    android:name="com.google.android.gms.version" 
    android:value="@integer/google_play_services_version" /> 

我必須手動輸入google_play_services_version

+0

你怎麼初始化PlusClient mPlusClient?發佈初始化代碼請 – StarsSky

+0

'mPlusClient = new PlusClient(this,this,this,Scopes.PLUS_PROFILE);' – Kunu

+0

@StarsSky它也顯示com.google.android.gms.plus.model.people.Person無法解析' – Kunu

回答