Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
Android Documentation
USBAccessoryAttachmentActivity

Class USBAccessoryAttachmentActivity

Hierarchy

java.lang.Object
     android.content.Context
         android.content.ContextWrapper
             android.view.ContextThemeWrapper
                 android.app.Activity

Package
com.smartdevicelink.transport

Overview

The USBAccessoryAttachmentActivity is a proxy to listen for USB_ACCESSORY_ATTACHED intents.

Unfortunately, the USB_ACCESSORY_ATTACHED intent can only be sent to an activity. So this class is a workaround to get that intent.

Some reference: http://stackoverflow.com/questions/6981736/android-3-1-usb-host-broadcastreceiver-does-not-receive-usb-device-attached/9814826#9814826

Inspired by OpenXC-Android: https://github.com/openxc/openxc-android

NOTE: An application that wants to use USB transport must make the following changes to AndroidManifest.xml:

1. Add these lines to the {@literal …} scope:
{@code
 
 
 }
2. Add these lines to the {@literal …} scope:
{@code 
     
         
     
     
 
 }

Fields

Inherited Fields

From Class Fields
android.app.Activity DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
android.content.Context ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APPWIDGET_SERVICE, APP_OPS_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, FINGERPRINT_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE

Constructors

USBAccessoryAttachmentActivity()

public USBAccessoryAttachmentActivity()

Methods

onCreate( Bundle savedInstanceState )

protected void onCreate(Bundle savedInstanceState)

Method Parameters

savedInstanceState

onResume()

protected void onResume()

onNewIntent( Intent intent )

protected void onNewIntent(Intent intent)

Method Parameters

intent

onDestroy()

protected void onDestroy()

Inherited Methods

From Class Methods
android.app.Activity getIntent, setIntent, getApplication, isChild, getParent, getWindowManager, getWindow, getLoaderManager, getCurrentFocus, onCreate, onCreate, onRestoreInstanceState, onRestoreInstanceState, onPostCreate, onPostCreate, onStart, onRestart, onStateNotSaved, onResume, onPostResume, isVoiceInteraction, isVoiceInteractionRoot, getVoiceInteractor, onNewIntent, onSaveInstanceState, onSaveInstanceState, onPause, onUserLeaveHint, onCreateThumbnail, onCreateDescription, onProvideAssistData, onProvideAssistContent, showAssist, onStop, onDestroy, reportFullyDrawn, onConfigurationChanged, getChangingConfigurations, getLastNonConfigurationInstance, onRetainNonConfigurationInstance, onLowMemory, onTrimMemory, getFragmentManager, onAttachFragment, managedQuery, startManagingCursor, stopManagingCursor, findViewById, getActionBar, setActionBar, setContentView, setContentView, setContentView, addContentView, getContentTransitionManager, setContentTransitionManager, getContentScene, setFinishOnTouchOutside, setDefaultKeyMode, onKeyDown, onKeyLongPress, onKeyUp, onKeyMultiple, onBackPressed, onKeyShortcut, onTouchEvent, onTrackballEvent, onGenericMotionEvent, onUserInteraction, onWindowAttributesChanged, onContentChanged, onWindowFocusChanged, onAttachedToWindow, onDetachedFromWindow, hasWindowFocus, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchTouchEvent, dispatchTrackballEvent, dispatchGenericMotionEvent, dispatchPopulateAccessibilityEvent, onCreatePanelView, onCreatePanelMenu, onPreparePanel, onMenuOpened, onMenuItemSelected, onPanelClosed, invalidateOptionsMenu, onCreateOptionsMenu, onPrepareOptionsMenu, onOptionsItemSelected, onNavigateUp, onNavigateUpFromChild, onCreateNavigateUpTaskStack, onPrepareNavigateUpTaskStack, onOptionsMenuClosed, openOptionsMenu, closeOptionsMenu, onCreateContextMenu, registerForContextMenu, unregisterForContextMenu, openContextMenu, closeContextMenu, onContextItemSelected, onContextMenuClosed, onCreateDialog, onCreateDialog, onPrepareDialog, onPrepareDialog, showDialog, showDialog, dismissDialog, removeDialog, onSearchRequested, onSearchRequested, getSearchEvent, startSearch, triggerSearch, takeKeyEvents, requestWindowFeature, setFeatureDrawableResource, setFeatureDrawableUri, setFeatureDrawable, setFeatureDrawableAlpha, getLayoutInflater, getMenuInflater, onApplyThemeResource, requestPermissions, onRequestPermissionsResult, shouldShowRequestPermissionRationale, startActivityForResult, startActivityForResult, startIntentSenderForResult, startIntentSenderForResult, startActivity, startActivity, startActivities, startActivities, startIntentSender, startIntentSender, startActivityIfNeeded, startActivityIfNeeded, startNextMatchingActivity, startNextMatchingActivity, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startIntentSenderFromChild, startIntentSenderFromChild, overridePendingTransition, setResult, setResult, getReferrer, onProvideReferrer, getCallingPackage, getCallingActivity, setVisible, isFinishing, isDestroyed, isChangingConfigurations, recreate, finish, finishAffinity, finishFromChild, finishAfterTransition, finishActivity, finishActivityFromChild, finishAndRemoveTask, releaseInstance, onActivityResult, onActivityReenter, createPendingResult, setRequestedOrientation, getRequestedOrientation, getTaskId, isTaskRoot, moveTaskToBack, getLocalClassName, getComponentName, getPreferences, getSystemService, setTitle, setTitle, setTitleColor, getTitle, getTitleColor, onTitleChanged, onChildTitleChanged, setTaskDescription, setProgressBarVisibility, setProgressBarIndeterminateVisibility, setProgressBarIndeterminate, setProgress, setSecondaryProgress, setVolumeControlStream, getVolumeControlStream, setMediaController, getMediaController, runOnUiThread, onCreateView, onCreateView, dump, isImmersive, requestVisibleBehind, onVisibleBehindCanceled, onEnterAnimationComplete, setImmersive, startActionMode, startActionMode, onWindowStartingActionMode, onWindowStartingActionMode, onActionModeStarted, onActionModeFinished, shouldUpRecreateTask, navigateUpTo, navigateUpToFromChild, getParentActivityIntent, setEnterSharedElementCallback, setExitSharedElementCallback, postponeEnterTransition, startPostponedEnterTransition, startLockTask, stopLockTask, showLockTaskEscapeMessage
android.view.ContextThemeWrapper attachBaseContext, applyOverrideConfiguration, getResources, setTheme, getTheme, getSystemService, onApplyThemeResource
android.content.ContextWrapper attachBaseContext, getBaseContext, getAssets, getResources, getPackageManager, getContentResolver, getMainLooper, getApplicationContext, setTheme, getTheme, getClassLoader, getPackageName, getApplicationInfo, getPackageResourcePath, getPackageCodePath, getSharedPreferences, openFileInput, openFileOutput, deleteFile, getFileStreamPath, fileList, getFilesDir, getNoBackupFilesDir, getExternalFilesDir, getExternalFilesDirs, getObbDir, getObbDirs, getCacheDir, getCodeCacheDir, getExternalCacheDir, getExternalCacheDirs, getExternalMediaDirs, getDir, openOrCreateDatabase, openOrCreateDatabase, deleteDatabase, getDatabasePath, databaseList, getWallpaper, peekWallpaper, getWallpaperDesiredMinimumWidth, getWallpaperDesiredMinimumHeight, setWallpaper, setWallpaper, clearWallpaper, startActivity, startActivity, startActivities, startActivities, startIntentSender, startIntentSender, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyOrderedBroadcast, removeStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcastAsUser, removeStickyBroadcastAsUser, registerReceiver, registerReceiver, unregisterReceiver, startService, stopService, bindService, unbindService, startInstrumentation, getSystemService, getSystemServiceName, checkPermission, checkCallingPermission, checkCallingOrSelfPermission, checkSelfPermission, enforcePermission, enforceCallingPermission, enforceCallingOrSelfPermission, grantUriPermission, revokeUriPermission, checkUriPermission, checkCallingUriPermission, checkCallingOrSelfUriPermission, checkUriPermission, enforceUriPermission, enforceCallingUriPermission, enforceCallingOrSelfUriPermission, enforceUriPermission, createPackageContext, createConfigurationContext, createDisplayContext, isRestricted
android.content.Context getAssets, getResources, getPackageManager, getContentResolver, getMainLooper, getApplicationContext, registerComponentCallbacks, unregisterComponentCallbacks, getText, getString, getString, getColor, getDrawable, getColorStateList, setTheme, getTheme, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, getClassLoader, getPackageName, getApplicationInfo, getPackageResourcePath, getPackageCodePath, getSharedPreferences, openFileInput, openFileOutput, deleteFile, getFileStreamPath, getFilesDir, getNoBackupFilesDir, getExternalFilesDir, getExternalFilesDirs, getObbDir, getObbDirs, getCacheDir, getCodeCacheDir, getExternalCacheDir, getExternalCacheDirs, getExternalMediaDirs, fileList, getDir, openOrCreateDatabase, openOrCreateDatabase, deleteDatabase, getDatabasePath, databaseList, getWallpaper, peekWallpaper, getWallpaperDesiredMinimumWidth, getWallpaperDesiredMinimumHeight, setWallpaper, setWallpaper, clearWallpaper, startActivity, startActivity, startActivities, startActivities, startIntentSender, startIntentSender, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyOrderedBroadcast, removeStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcastAsUser, removeStickyBroadcastAsUser, registerReceiver, registerReceiver, unregisterReceiver, startService, stopService, bindService, unbindService, startInstrumentation, getSystemService, getSystemService, getSystemServiceName, checkPermission, checkCallingPermission, checkCallingOrSelfPermission, checkSelfPermission, enforcePermission, enforceCallingPermission, enforceCallingOrSelfPermission, grantUriPermission, revokeUriPermission, checkUriPermission, checkCallingUriPermission, checkCallingOrSelfUriPermission, checkUriPermission, enforceUriPermission, enforceCallingUriPermission, enforceCallingOrSelfUriPermission, enforceUriPermission, createPackageContext, createConfigurationContext, createDisplayContext, isRestricted
java.lang.Object getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize
View on GitHub.com
Previous Section Next Section