title: (Android) How can I start a service upon file selection?
body: <p>I need to discover the method for starting an iconified background service upon selection of a specific file type. I have been at this all day and it is driving me up the wall :(</p>
  
  <p>The following is what I have arrived at thus far:</p>
  
  <pre><code>&lt;intent-filter&gt;
      &lt;action android:name="android.intent.action.VIEW" /&gt;
      &lt;category android:name="android.intent.category.DEFAULT" /&gt;
      &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
      &lt;data android:mimeType="*/*" /&gt;
      &lt;data android:pathPattern="*.txt" /&gt;
  &lt;/intent-filter&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>public class MainThread extends Service {
      public MainThread() {
      }
  
      @Override
      public IBinder onBind(Intent intent) {
          // TODO: Return the communication channel to the service.
          throw new UnsupportedOperationException("Not yet implemented");
      }
  
      @Override
      public void onCreate() {
          Toast.makeText(this, "The new Service was Created", Toast.LENGTH_LONG)
                  .show();
  
      }
  
      @Override
      public void onStart(Intent intent, int startId) {
          // This is where I process my file...
          Toast.makeText(this, " Service Started", Toast.LENGTH_LONG).show();
  
      }
  
      @Override
      public void onDestroy() {
          Toast.makeText(this, "Service Destroyed", Toast.LENGTH_LONG).show();
  
      }
  }
  </code></pre>