customizing the 'Google Market error' message in samples
authorAndrey Pavlenko <no@email>
Sat, 14 Jul 2012 19:49:00 +0000 (19:49 +0000)
committerAndrey Pavlenko <no@email>
Sat, 14 Jul 2012 19:49:00 +0000 (19:49 +0000)
samples/android/15-puzzle/src/org/opencv/samples/puzzle15/puzzle15Activity.java
samples/android/color-blob-detection/src/org/opencv/samples/colorblobdetect/ColorBlobDetectionActivity.java
samples/android/face-detection/src/org/opencv/samples/fd/FdActivity.java
samples/android/image-manipulations/src/org/opencv/samples/imagemanipulations/ImageManipulationsActivity.java
samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/Sample1Java.java
samples/android/tutorial-2-opencvcamera/src/org/opencv/samples/tutorial2/Sample2NativeCamera.java
samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/Sample3Native.java
samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/Sample4Mixed.java

index 7905192..91e58c6 100644 (file)
@@ -45,6 +45,21 @@ public class puzzle15Activity extends Activity
                                                ad.show();
                                        }
                                } break;
+                               /** OpenCV loader cannot start Google Play **/
+                               case LoaderCallbackInterface.MARKET_ERROR:
+                               {
+                                       Log.d(TAG, "Google Play service is not accessible!");
+                                       AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+                                       MarketErrorMessage.setTitle("OpenCV Manager");
+                                       MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install file_name.apk' command.");
+                                       MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+                                       MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
+                                               public void onClick(DialogInterface dialog, int which) {
+                                                       mAppContext.finish();
+                                               }
+                                       });
+                                       MarketErrorMessage.show();
+                               } break;
                                default:
                                {
                                        super.onManagerConnected(status);
index b959dd2..bd1bf83 100644 (file)
@@ -40,6 +40,21 @@ public class ColorBlobDetectionActivity extends Activity {
                                                        ad.show();
                                                }
                                        } break;
+                           /** OpenCV loader cannot start Google Play **/
+                           case LoaderCallbackInterface.MARKET_ERROR:
+                           {
+                               Log.d(TAG, "Google Play service is not accessible!");
+                               AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+                               MarketErrorMessage.setTitle("OpenCV Manager");
+                               MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install file_name.apk' command.");
+                               MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+                               MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
+                                   public void onClick(DialogInterface dialog, int which) {
+                                       mAppContext.finish();
+                                   }
+                               });
+                               MarketErrorMessage.show();
+                           } break;
                                        default:
                                        {
                                                super.onManagerConnected(status);
index 1577a01..bc63b38 100644 (file)
@@ -54,6 +54,21 @@ public class FdActivity extends Activity {
                                                ad.show();
                                        }
                                } break;
+                               /** OpenCV loader cannot start Google Play **/
+                               case LoaderCallbackInterface.MARKET_ERROR:
+                               {
+                                       Log.d(TAG, "Google Play service is not accessible!");
+                                       AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+                                       MarketErrorMessage.setTitle("OpenCV Manager");
+                                       MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install file_name.apk' command.");
+                                       MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+                                       MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
+                                               public void onClick(DialogInterface dialog, int which) {
+                                                       mAppContext.finish();
+                                               }
+                                       });
+                                       MarketErrorMessage.show();
+                               } break;
                                default:
                                {
                                        super.onManagerConnected(status);
index de71365..d265f31 100644 (file)
@@ -63,6 +63,21 @@ public class ImageManipulationsActivity extends Activity {
                                                ad.show();
                                        }
                                } break;
+                               /** OpenCV loader cannot start Google Play **/
+                               case LoaderCallbackInterface.MARKET_ERROR:
+                               {
+                                       Log.d(TAG, "Google Play service is not accessible!");
+                                       AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+                                       MarketErrorMessage.setTitle("OpenCV Manager");
+                                       MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install file_name.apk' command.");
+                                       MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+                                       MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
+                                               public void onClick(DialogInterface dialog, int which) {
+                                                       mAppContext.finish();
+                                               }
+                                       });
+                                       MarketErrorMessage.show();
+                               } break;
                                default:
                                {
                                        super.onManagerConnected(status);
index 7581639..f8885f0 100644 (file)
@@ -45,6 +45,21 @@ public class Sample1Java extends Activity {
                                                ad.show();
                                        }
                                } break;
+                               /** OpenCV loader cannot start Google Play **/
+                               case LoaderCallbackInterface.MARKET_ERROR:
+                               {
+                                       Log.d(TAG, "Google Play service is not accessible!");
+                                       AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+                                       MarketErrorMessage.setTitle("OpenCV Manager");
+                                       MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install file_name.apk' command.");
+                                       MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+                                       MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
+                                               public void onClick(DialogInterface dialog, int which) {
+                                                       mAppContext.finish();
+                                               }
+                                       });
+                                       MarketErrorMessage.show();
+                               } break;
                                default:
                                {
                                        super.onManagerConnected(status);
index 13437d7..d72bea8 100644 (file)
@@ -52,6 +52,21 @@ public class Sample2NativeCamera extends Activity {
                                                ad.show();
                                        }
                                } break;
+                               /** OpenCV loader cannot start Google Play **/
+                               case LoaderCallbackInterface.MARKET_ERROR:
+                               {
+                                       Log.d(TAG, "Google Play service is not accessible!");
+                                       AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+                                       MarketErrorMessage.setTitle("OpenCV Manager");
+                                       MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install file_name.apk' command.");
+                                       MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+                                       MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
+                                               public void onClick(DialogInterface dialog, int which) {
+                                                       mAppContext.finish();
+                                               }
+                                       });
+                                       MarketErrorMessage.show();
+                               } break;
                                default:
                                {
                                        super.onManagerConnected(status);
index f4d9bf7..e228f2e 100644 (file)
@@ -43,6 +43,21 @@ public class Sample3Native extends Activity {
                                                ad.show();
                                        }
                                } break;
+                               /** OpenCV loader cannot start Google Play **/
+                               case LoaderCallbackInterface.MARKET_ERROR:
+                               {
+                                       Log.d(TAG, "Google Play service is not accessible!");
+                                       AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+                                       MarketErrorMessage.setTitle("OpenCV Manager");
+                                       MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install file_name.apk' command.");
+                                       MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+                                       MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
+                                               public void onClick(DialogInterface dialog, int which) {
+                                                       mAppContext.finish();
+                                               }
+                                       });
+                                       MarketErrorMessage.show();
+                               } break;
                                default:
                                {
                                        super.onManagerConnected(status);
index 2ea0fe1..1ac4aec 100644 (file)
@@ -51,6 +51,21 @@ public class Sample4Mixed extends Activity {
                                                ad.show();
                                        }
                                } break;
+                               /** OpenCV loader cannot start Google Play **/
+                               case LoaderCallbackInterface.MARKET_ERROR:
+                               {
+                                       Log.d(TAG, "Google Play service is not accessible!");
+                                       AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+                                       MarketErrorMessage.setTitle("OpenCV Manager");
+                                       MarketErrorMessage.setMessage("Google Play service is not accessible!\nTry to install the 'OpenCV Manager' and the appropriate 'OpenCV binary pack' APKs from OpenCV SDK manually via 'adb install file_name.apk' command.");
+                                       MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+                                       MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
+                                               public void onClick(DialogInterface dialog, int which) {
+                                                       mAppContext.finish();
+                                               }
+                                       });
+                                       MarketErrorMessage.show();
+                               } break;
                                default:
                                {
                                        super.onManagerConnected(status);