3. Camera Lens App
You can also create a specialized application
called a Camera Lens application that enables the user to access your
application as a “lens” in the camera of the phone directly. For a
user, your application shows up in the lens in the camera application,
as shown in Figure 2.
FIGURE 2 The Camera Lens button
After the user taps the Lens button, they are
presented with all the applications that support the Lens
functionality. You can see a sample app “MyLens” shown in Figure 3.
FIGURE 3 The camera lenses
When a user selects a
lens, the specific app is launched and the app must implement a
camera-like experience. If you are using the one of the previous
methods to implement your camera (for example, PhotoCamera
class), you can just show that page of your application. To be
registered for this special type of application, you have to tell the WMAppManifest.xml
file that your app supports an extension. Unfortunately, the editor in
Visual Studio does not support setting these extensions directly. So
you have to open the WMAppManifest.xml
file as XML. You can accomplish this by right-clicking the WMAppManifest.xml
file and selecting “View Code.” As a child of the App element, you need to add a section called Extensions, like so:
<Deployment xmlns="..."
AppPlatformVersion="8.0">
<DefaultLanguage xmlns=""
code="en-US" />
<App ...>
...
<Extensions>
<Extension ExtensionName="Camera_Capture_App"
ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5631}"
TaskID="_default" />
</Extensions>
...
</App>
</Deployment>
The extension type and GUID for the ConsumerID
are shown here. These are specific GUID values and not specific to your application. This value must be used. The TaskID
should be “_default” that points to the default task in the list of
Tasks in the XML file. After this is done, the lens will be registered
with the camera on installation of the application.