Is there any way to know(programmatically) in your Activity/Application that the user has connected your phone to PC through USB?
Was able to detect USB connection by registering a broadcast receiver by following,
IntentFilter mIntentFilter = new IntentFilter(Intent.ACTION_UMS_CONNECTED); BroadcastReceiver bd = new intentReceiver(); registerReceiver(bd, mIntentFilter);