Auto-launching with AutoPlay (Windows Store apps using JavaScript and HTML)

Language: JavaScript and HTML | VB/C#/C++ and XAML
9 out of 20 rated this helpful - Rate this topic

Purpose

You can use AutoPlay to provide your app as an option when a user connects a device to their computer. This includes non-volume devices such as a camera or media player, or volume devices such as a USB thumb drive, SD card, or DVD. You can also use AutoPlay to offer your app as an option when users share files between two machines by using Proximity (tapping).

In this section

TopicDescription

Quickstart: Register an app for AutoPlay content

You can register apps as options for AutoPlay content events. AutoPlay content events are raised when a volume device such as a camera memory card, thumb drive, or DVD is inserted into the computer.

Quickstart: Register an app for an AutoPlay device

You can register apps as options for AutoPlay device events. AutoPlay device events are raised when a device is connected to a computer.

Quickstart: Configure removable storage as an AutoPlay device

You can identify a volume device such as a memory card or thumb drive as an AutoPlay device when the volume device is connected to a computer. This is especially useful when you want to associate a specific app for AutoPlay to present to the user for your volume device.

 

Developer audience

Developers use AutoPlay when they create apps that respond to a user initiated device connection. You can use AutoPlay to perform an action on the user's behalf by offering a handler for a particular device. When a user connects a device, AutoPlay determines the type of device and raises either a device event for non-volume devices, or a content event for volume devices. You can register for the event that corresponds to your app by adding a Declaration in your application manifest for the specific event type. After you have built and deployed your app, AutoPlay recognizes the declaration for the app. AutoPlay then includes it in the list of possible actions that a user can take to respond to that event. For an example, see Quickstart: How to register an application for AutoPlay.

You can also perform an action when a user has received files that are shared by using Proximity (tapping). In this case, the files are placed in a temporary folder on the target computer and AutoPlay raises a content event based on the type of files shared.

AutoPlay Events

The AutoPlay system allows apps to register for a variety of device and volume (disk) arrival events. In order to register for AutoPlay content events, you must enable the Removable Storage capability in your package manifest. The following table shows the events that you can register for and when they are raised.

ScenarioEventDescription
Using photos on a CameraWPD\ImageSourceRaised for cameras that are identified as Windows Portable Devices and offer the ImageSource capability.
Using music on an audio playerWPD\AudioSourceRaised for media players that are identified as Windows Portable Devices and offer the AudioSource capability.
Using videos on a video cameraWPD\VideoSourceRaised for video cameras that are identified as Windows Portable Devices and offer the VideoSource capability.
Access a connected flash drive or external hard driveStorageOnArrivalRaised when a drive or volume is connected to the computer.   If the drive or volume contains a DCIM, AVCHD, or PRIVATE\ACHD folder in the root of the disk, the ShowPicturesOnArrival event is raised instead.
Using photos from mass storage (legacy)ShowPicturesOnArrival Raised when a drive or volume contains a DCIM, AVCHD, or PRIVATE\ACHD folder in the root of the disk. If a user  has enabled Choose what to do with each type of media in the AutoPlay Control Panel, AutoPlay examines a volume connected to the computer to determine the type of content on the disk. When pictures are found, ShowPicturesOnArrival is raised.
Receiving photos with Proximity Sharing (tap and send)ShowPicturesOnArrival When users send content with using proximity (tap and send), AutoPlay examines the shared files to determine the type of content. If pictures are found, ShowPicturesOnArrival is raised.
Using music from mass storage (legacy)PlayMusicFilesOnArrival If a user enables Choose what to do with each type of media in the AutoPlay Control Panel, AutoPlay examines a volume connected to the computer to determine the type of content on the disk.  When music files are found, PlayMusicFilesOnArrival is raised.
Receiving music with Proximity Sharing (tap and send)PlayMusicFilesOnArrival When users send content with using proximity (tap and send), AutoPlay examines the shared files to determine the type of content. If music files are found, PlayMusicFilesOnArrival is raised.
Using videos from mass storage (legacy)PlayVideoFilesOnArrival If a user has enabled Choose what to do with each type of media in the AutoPlay Control Panel, AutoPlay examines a volume connected to the computer to determine the type of content on the disk. When video files are found, PlayVideoFilesOnArrival is raised.
Receiving videos with Proximity Sharing (tap and send)PlayVideoFilesOnArrival When users send content by using proximity (tap and send), AutoPlay examines the shared files to determine the type of content. If video files are found, PlayVideoFilesOnArrival is raised.
Handling mixed sets of files from a connected deviceMixedContentOnArrival If a user enables Choose what to do with each type of media in the AutoPlay Control Panel, AutoPlay examines a volume connected to the computer to determine the type of content on the disk. If no specific content type is found (for example, pictures), MixedContentOnArrival is raised.
Handling mixed sets of files with Proximity Sharing (tap and send)MixedContentOnArrival When users send content by using proximity (tap and send), AutoPlay examines the shared files to determine the type of content. If no specific content type is found (for example, pictures), MixedContentOnArrival is raised.
Handle video from optical media

PlayDVDMovieOnArrival

PlayBluRayOnArrival

PlayVideoCDMovieOnArrival

PlaySuperVideoCDMovieOnArrival

Handle music from optical media

PlayCDAudioOnArrival

PlayDVDAudioOnArrival

Play enhanced disks

PlayEnhancedCDOnArrival

PlayEnhancedDVDOnArrival

Handle writeable optical disks

HandleCDBurningOnArrival

HandleDVDBurningOnArrival

HandleBDBurningOnArrival

Handle any other device or volume connectionUnknownContentOnArrivalRaised for all events in case content is found that does not match any of the AutoPlay content events. Use of this event is not recommended. You should only register your application for the specific AutoPlay events that it can handle.

 

You can specify that AutoPlay raise a custom AutoPlay Content event using the CustomEvent entry in the autorun.inf file for a volume. For More information, see Autorun.inf entries.

You can register your app as an AutoPlay Content or AutoPlay Device event handler by adding an extension to the package.appxmanifest file for your app. If you are using Microsoft Visual Studio, you can add an AutoPlay Content or AutoPlay Device declaration in the Declarations tab. For an example, see Quickstart: How to register an application for AutoPlay. If you are editing the package.appxmanifest file for your app directly, add an Extension element to your package manifest that specifies either windows.autoPlayContent or windows.autoPlayDevice as the Category. For example, the following entry in the package manifest adds an AutoPlay Content extension to register the app as a handler for the ShowPicturesOnArrival event.


  <Applications>
    <Application Id="AutoPlayHandlerSample.App">
      <Extensions>
        <Extension Category="windows.autoPlayContent">
          <AutoPlayContent>
            <LaunchAction Verb="show" ActionDisplayName="Show Pictures" 
                          ContentEvent="ShowPicturesOnArrival" />
          </AutoPlayContent>
        </Extension>
      </Extensions>
    </Application>
  </Applications>

 

 

Build date: 10/26/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.