Android 更改PlayServices警报文本
我正在使用此代码检查播放服务是否可用Android 更改PlayServices警报文本,android,dialog,Android,Dialog,我正在使用此代码检查播放服务是否可用 public static boolean checkPlayServices(Context context, boolean showDialog) { int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context); if (resultCode != ConnectionResult.SUCCESS) { if (showD
public static boolean checkPlayServices(Context context, boolean showDialog) {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context);
if (resultCode != ConnectionResult.SUCCESS) {
if (showDialog) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, (BaseActivity) context, GooglePlayServicesUtil.GOOGLE_PLAY_SERVICES_VERSION_CODE);
dialog.show();
} else {
Log.d("FUApp", "This device is not supported.");
//finish();
}
}
return false;
}
return true;
}
是否可以在不创建新对话框的情况下更改对话框文本
原因是,我只想在他们试图使用需要播放服务的功能时显示错误,当前文本说此应用程序无法工作…
,而我想说此功能无法工作…
步骤1:
导入google-play-services_lib
到您的工作区
(您可以在以下路径找到它:/extras/google/google\u play\u services/
)
第二步:
转到其值
目录->strings.xml
并更改要更改的文本消息
第三步:
现在回到您自己的应用程序,将google-play-services_lib
作为库项目添加到您的应用程序中
你完了
编辑:
您可以在应用程序的strings.xml
中覆盖所需的字符串值,而不是在库的strings.xml
中进行更改
i、 e:
除非启用Google Play服务,否则此功能将无法工作。
您只需要导入库项目来处理文本,而不是使用其jar文件。我已经发布了一个答案。谢谢,我现在就开始:)。我目前正在使用gradle而不是导入库,导入它是实现这一目标的唯一方法吗?@TomHart:我对gradle不熟悉。我希望我也能学习它。
<string name="common_google_play_services_enable_text" msgid="227660514972886228">This feature won\'t work unless you enable Google Play services.</string>