Merge "Adds support for opening iOS phone app from wear and clearer message for Phone app to wear app failure to open play store, i.e., the wear device is 1.0 without the play store." into nyc-mr1-dev
diff --git a/wearable/wear/WearVerifyRemoteApp/Application/src/main/java/com/example/android/wearable/wear/wearverifyremoteapp/MainMobileActivity.java b/wearable/wear/WearVerifyRemoteApp/Application/src/main/java/com/example/android/wearable/wear/wearverifyremoteapp/MainMobileActivity.java
index 0d06ed5..ed15119 100644
--- a/wearable/wear/WearVerifyRemoteApp/Application/src/main/java/com/example/android/wearable/wear/wearverifyremoteapp/MainMobileActivity.java
+++ b/wearable/wear/WearVerifyRemoteApp/Application/src/main/java/com/example/android/wearable/wear/wearverifyremoteapp/MainMobileActivity.java
@@ -99,15 +99,16 @@
             if (resultCode == RemoteIntent.RESULT_OK) {
                 Toast toast = Toast.makeText(
                         getApplicationContext(),
-                        "Successfully sent to device",
+                        "Play Store Request to Wear device successful.",
                         Toast.LENGTH_SHORT);
                 toast.show();
 
             } else if (resultCode == RemoteIntent.RESULT_FAILED) {
                 Toast toast = Toast.makeText(
                         getApplicationContext(),
-                        "Failed to send to device.",
-                        Toast.LENGTH_SHORT);
+                        "Play Store Request Failed. Wear device(s) may not support Play Store, "
+                                + " that is, the Wear device may be version 1.0.",
+                        Toast.LENGTH_LONG);
                 toast.show();
 
             } else {
@@ -188,7 +189,7 @@
         // Initial request for devices with our capability, aka, our Wear app installed.
         findWearDevicesWithApp();
 
-        // Initial request for devices all Wear devices connected (with or without our capability).
+        // Initial request for all Wear devices connected (with or without our capability).
         // Additional Note: Because there isn't a listener for ALL Nodes added/removed from network
         // that isn't deprecated, we simply update the full list when the Google API Client is
         // connected and when capability changes come through in the onCapabilityChanged() method.
diff --git a/wearable/wear/WearVerifyRemoteApp/Wearable/src/main/java/com/example/android/wearable/wear/wearverifyremoteapp/MainWearActivity.java b/wearable/wear/WearVerifyRemoteApp/Wearable/src/main/java/com/example/android/wearable/wear/wearverifyremoteapp/MainWearActivity.java
index 260ed44..31882b0 100644
--- a/wearable/wear/WearVerifyRemoteApp/Wearable/src/main/java/com/example/android/wearable/wear/wearverifyremoteapp/MainWearActivity.java
+++ b/wearable/wear/WearVerifyRemoteApp/Wearable/src/main/java/com/example/android/wearable/wear/wearverifyremoteapp/MainWearActivity.java
@@ -72,12 +72,15 @@
     // IMPORTANT NOTE: This should be named differently than your Wear app's capability.
     private static final String CAPABILITY_PHONE_APP = "verify_remote_example_phone_app";
 
-
-    // Links to mobile app for Android (Play Store).
+    // Links to install mobile app for both Android (Play Store) and iOS.
     // TODO: Replace with your links/packages.
     private static final String PLAY_STORE_APP_URI =
             "market://details?id=com.example.android.wearable.wear.wearverifyremoteapp";
 
+    // TODO: Replace with your links/packages.
+    private static final String APP_STORE_APP_URI =
+            "https://itunes.apple.com/us/app/android-wear/id986496028?mt=8";
+
     // Result from sending RemoteIntent to phone to open app in play/app store.
     private final ResultReceiver mResultReceiver = new ResultReceiver(new Handler()) {
         @Override
@@ -263,6 +266,17 @@
             // Assume iPhone (iOS device) or Android without Play Store (not supported right now).
             case PlayStoreAvailability.PLAY_STORE_ON_PHONE_UNAVAILABLE:
                 Log.d(TAG, "\tPLAY_STORE_ON_PHONE_UNAVAILABLE");
+
+                // Create Remote Intent to open App Store listing of app on iPhone.
+                Intent intentIOS =
+                        new Intent(Intent.ACTION_VIEW)
+                                .addCategory(Intent.CATEGORY_BROWSABLE)
+                                .setData(Uri.parse(APP_STORE_APP_URI));
+
+                RemoteIntent.startRemoteActivity(
+                        getApplicationContext(),
+                        intentIOS,
+                        mResultReceiver);
                 break;
 
             case PlayStoreAvailability.PLAY_STORE_ON_PHONE_ERROR_UNKNOWN: