0
내 Android 용 Google Play 서비스 확인을하려고합니다. 나는이 링크에서 YT 가이드 다음 : https://www.youtube.com/watch?v=i2lKeTJpaWc 을 그리고 다음 코드 생성 : 문제없이 제대로 실행Android GooglePlayServices 컨텍스트 오류
public boolean servicesOK() {
int isAvailable = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (isAvailable == ConnectionResult.SUCCESS) {
return true;
}
else if (GooglePlayServicesUtil.isUserRecoverableError(isAvailable)) {
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(isAvailable, this, GPS_ERRORDIALOG_REQUEST);
dialog.show();
}
else {
Toast.makeText(this, "Can't connect to Google Play services", Toast.LENGTH_SHORT).show();
}
return false;
}
코드를, 그래서는 클래스 파일로 만들기로 결정했다. 문제가 발생했을 때 그게 전부다. 클래스에 대한
"The method isGooglePlayServicesAvailable(Context) in the type GooglePlayServicesUtil is not applicable for the arguments (PlayServices)"
전체 코드 : 나는 다음과 같은 오류 메시지가
package com.test.testmaps2;
import android.app.Dialog;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
public class PlayServices {
private static final int GPS_ERRORDIALOG_REQUEST = 9001;
public boolean servicesOK() {
int isAvailable = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (isAvailable == ConnectionResult.SUCCESS) {
return true;
}
else if (GooglePlayServicesUtil.isUserRecoverableError(isAvailable)) {
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(isAvailable, this, GPS_ERRORDIALOG_REQUEST);
dialog.show();
}
else {
Toast.makeText(this, "Can't connect to Google Play services", Toast.LENGTH_SHORT).show();
}
return false;
}
}
가, 감사합니다! – Sletten