diff --git a/res/values/strings.xml b/res/values/strings.xml
index a8fd663fb0..6aaf6fdae3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -279,6 +279,9 @@
Submit passphrase
Invalid passphrase!
+
+ The version of Google Play Services you have installed is not functioning correctly. Please reinstall Google Play Services and try again.
+
Rate this app
If you enjoy using this app, please take a moment to help us by rating it.
diff --git a/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java b/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java
index aebec3b700..82ff600f42 100644
--- a/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java
+++ b/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java
@@ -17,19 +17,47 @@
package org.thoughtcrime.securesms;
+import android.app.Activity;
import android.app.Dialog;
+import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
+import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.gms.common.GooglePlayServicesUtil;
public class PlayServicesProblemFragment extends DialogFragment {
@Override
- public Dialog onCreateDialog(@NonNull Bundle bundle) {
- int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
- return GooglePlayServicesUtil.getErrorDialog(code, getActivity(), 9111);
+ public @NonNull Dialog onCreateDialog(@NonNull Bundle bundle) {
+ int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
+ Dialog dialog = GooglePlayServicesUtil.getErrorDialog(code, getActivity(), 9111);
+
+ if (dialog == null) {
+ return new MaterialDialog.Builder(getActivity()).negativeText(android.R.string.ok)
+ .content(getActivity().getString(R.string.PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning))
+ .build();
+ } else {
+ return dialog;
+ }
}
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ super.onCancel(dialog);
+ finish();
+ }
+
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ super.onDismiss(dialog);
+ finish();
+ }
+
+ private void finish() {
+ Activity activity = getActivity();
+ if (activity != null) activity.finish();
+ }
+
}