public class MainActivity extends Activity implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
private GoogleApiClient mGoogleClient;
private TextView _text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 오류 발생
mGoogleClient = new GoogleApiClient.Builder(this, this, this).addApi(
LocationServices.API).build();
_text = (TextView) findViewById(R.id.textView1);
Button btn1 = (Button) findViewById(R.id.button1);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 오류 발생
Location location = LocationServices.FusedLocationApi
.getLastLocation(mGoogleClient);
}
});
}
@Override
protected void onStart() {
super.onStart();
mGoogleClient.connect();
}
@Override
protected void onStop() {
mGoogleClient.disconnect();
super.onStop();
}
@Override
public void onConnected(Bundle connectionHint) {
}
@Override
public void onConnectionSuspended(int cause) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
if (connectionResult.hasResolution()) {
try {
connectionResult.startResolutionForResult(this, 0);
} catch (IntentSender.SendIntentException e) {
}
} else {
}
}
}
안녕하세요. 현재위치 구하기 위해 구현중에 질문 남깁니다.
googlePlayService api를 이용해서 위치를 구하려고 하는데요.
google-play-services_lib을 추가해주고 했는데 LocationServices부분만 오류가 발생합니다.
LocationServices는 따로 라이브러리 추가해야되나요?