title: Detect USB in Broadcastreceiver - what am I missing?
body: <p>My code misses something, need your eyes to locate.</p>
  
  <p>I created a USBOnReciever broadcastreceiver.</p>
  
  <pre><code>public class USBOnReceiver extends BroadcastReceiver
  { 
  @Override
  public void onReceive(Context context, Intent intent) 
  {
      Toast.makeText(context,  "Phone was connected to power" ,Toast.LENGTH_LONG).show();
      Log.d("tag", "Phone was connected to power");
  } 
  } 
  </code></pre>
  
  <p>My manifest is:</p>
  
  <pre><code>&lt;application&gt;
      &lt;receiver android:name=".USBOnReceiver" android:enabled="true"
          android:exported="true"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.UMS_CONNECTED" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p>and here is when I stuck.
  nothing appears to happen when connecting the USB ( I also tried with power_connected).</p>
  
  <p>I understand I can register the BR either through the manifest or programmaticaly. But not sure how to implement.</p>
  
  <p>In my activity I added</p>
  
  <pre><code>        USBOnReceiver myReceiver = new USBOnReceiver();
  </code></pre>
  
  <p>But it looks so unconnected and useless :-/</p>
  
  <p>Will appreciate your eyes here.</p>