title: How do I prevent a service app from launching its ui activity when it starts?
body: <p>I want to send a message from a mobile app to a wear app and when the wear app receives it for it to display some UI activity.</p>
  
  <p>I have everything in place and working already for this (the mobile app is using Wearable.MessageApi.sendMessage and the wear app is extending WearableListenerService). However my problem is that when I run the wear app the UI appears as it launches, what should I change so that nothing is displayed until the wear app receives the message from the mobile? How do I prevent the Activity's from being created at app launch time?</p>
  
  <p>Manifest:</p>
  
  <pre><code>   &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@android:style/Theme.DeviceDefault" &gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;service android:name=".WearMessageListenerService"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.android.gms.wearable.BIND_LISTENER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
      &lt;/application&gt;
  </code></pre>
  
  <p>Activity:</p>
  
  <pre><code>public class MainActivity extends Activity {
      private TextView mTextView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          Log.i("WEAR", "onCreate");
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
          stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
              @Override
              public void onLayoutInflated(WatchViewStub stub) {
                  mTextView = (TextView) stub.findViewById(R.id.text);
              }
          });
      }
  }
  </code></pre>
  
  <p>Service:</p>
  
  <pre><code>public class WearMessageListenerService extends WearableListenerService {
      private static final String START_ACTIVITY = "/start_activity";
      @Override
      public void onMessageReceived(MessageEvent messageEvent) {
          Log.i("WEAR", "WearableListenerService:onMessageReceived");
          if( messageEvent.getPath().equalsIgnoreCase( START_ACTIVITY ) ) {
              Intent intent = new Intent( this, MainActivity.class );
              intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
              startActivity( intent );
          } else {
              super.onMessageReceived(messageEvent);
          }
      }
  }
  </code></pre>