WP8.0 vs WP8.1 - All About New Package.appxmanifest File at Beginners Level

Introduction

I believe you might already be familiar with the new Windows Phone 8.1 SDK that is now the old Windows Phone 8.0. The "WMAppManifest.xml" file is renamed to "Package.appxmanifest" that is very similar to the Windows Store apps. Package.appxmanifest is a XML file that includes all the info of our application, such as the targeted app OS version, App display name, App icons, capability permissions to run app, Start page to be the App launch and so on. And every app package must have one package manifest file and of course by default it is created by Visual Studio 2013 when you create the new app. Ok let's see the following image to understand how many new tabs are added to the new package manifest file.



The following are the requirements to work with this article:

  • Make sure you've downloaded and installed the Windows Phone SDK. For more information, see Get the SDK.
  • This article assumes you're using Microsoft Visual Studio Express 2013 for Windows.

Description

  1. The actual role of Package.appxmanifest

    When we run our app during the compilation process the app package will be installed with file extension of .appx (Note: Now it isn't a XAP anymore) so it's time to role of the Package.appxmanifest that can introduce your app to the phone like this:

    • The app's name and icons to display in the phone app list
    • Assemblies and assets that are included in the appx (hints: it depends on the build action type of file)
    • Asset files should be used for the start and apps screen of the phone (hints: Resource files and styles)
    • Start page to be launched and more
    • You must read this AppPackages importance

  2. How to open the package.appxmanifest file in Windows Phone store

    You can find the package.appxmanifest file in your project Solution Explorer. And you can open this in one of the following two ways.

    1. Tab designer mode:



      After double-clicking on a file, you will find the tab designer like this:



    2. XML Editor mode

      As we already discussed in the "Introduction" section, the package.appxmanifest file is an XML document, but the above designer mode is a lightweight process to use and that's simplicity. Okay to open the file in the XML editor mode right-click on the "package.appxmanifest" file from the Solution Explorer then select Open with, you will then find a dialog, select XML (Text) Editor. So you will find the package.appxmanifest file like this:



      Note: Don't edit this file, if you want to make any changes then close this XML mode and then please open the file in the designer mode as dexribed previously and edit it as needed.

  3. The new tabs in the package.appxmanifest file

    This is the most important section, please see in the top of this article, there is one image in the "Introduction" section. I hope that by referencing that image you get an idea of how many extra tabs are available in the package.appxmanifest file. So in the new package.appxmanifest file there is the following seven tabs available.

    • Application
    • Visual Assets
    • Requirements
    • Capabilities
    • Declarations
    • Content URIs
    • Packaging

    1. Application tab

      This is a very important tab that describes the basic info of our application.



      Basic Info: (App name, App icon, Default Language)

      Supported Rotations: Enable/Disable App screen rotations

      Prevent installation of the app to SD cards: to prevent users from sharing your app. (Note: this is the new feature added to WP 8.1 SDK.)

      Notification Settings: To enable/disable Toast/Lock Notifications

      • Toast capable: Toast displays at the top of the screen to notify users of an event, such as a new email alert that are 10 seconds unless the user dismisses it with a flick to the right. If the user taps the toast, by default, your app's Start Screen launches. Or, you can choose to specify which screen of your app will launch. And this option has the two values "Yes" and "No" to enable/disable a toast from your app.



      • Lock Screen Notifications: Lock screen notifications allow you to update the lock screen with text messages or numbers usually indicating that there's a number of updated items the user should be aware of. And this option has the two values "Yes" and "No" to enable/disable lock notification from your app.



    2. Visual Assets tab

      This tab is entirely related to app logos, splash-screen images, Tile/Lock screen notification logos and Store Logos. And be sure you have a differently sized image as was mentioned.



    3. Requirements tab

      This tab is related to hardware, for example if you want to make a front camera in your app, you must select the "Front Camera" option from the Requirements tab. And your app is only installed on the device that meets the hardware requirements.



    4. Capabilities Tab

      When accessing any private information of the user device, your app must ask the user for permission. Suppose your app is trying to get phone contacts, then you must enable the "Contacts" option from the capabilities tab. Otherwise you will get an exception like "unauthorized". And read more here.



    5. Declarations Tab

      If you want to implement an app that will be a shared target then you need to specify what you want to receive in the appxmainifest. For example an app to receive pictures may look something like this:



      When your app is selected to be a shared target your app is started and you capture the shared object in OnShareTargetActivated that shall be set in App.xaml.cs. Example:



      Inside args.ShareOperation.Data there are many functions to call to get the shared content. You already know what functions to use since this is stated in the appxmainfest. In the example above we would use args.ShareOperation.Data.GetStorageItemsAsync(). After the share is done call ReportCompleted to tell the system to return to the calling app.

      Another Example: in the case of the File Open Picker, you can allow other apps to use your app to choose a given file managed by your app.

    6. Content URIs Tab

      Have you heard of the command "window.external.notify" in JavaScript that is useful for running an external website that passes a date to our app. So it is best practices if you need to indicate which URI's you want to allow to pass information into your app on this page and it must be one with an SSL certificate.



      Finally in your side, you need to handle the ScriptNotify event and retrieve the data being sent.

      For example:

      XAML:



      C#:



    7. Packaging Tab

      Finally this tab is used to set the properties used to package your app.



      Observe in the following there is an option to set an app "Bundle" that havs three sub options (If Needed, Always, Never). If you create an app bundle, you can submit your app to the Store more easily because, no matter how many architectures your app supports, you must upload only one .appxupload file. If you don't create an app bundle, you must upload an .appxupload file for each supported architecture. And read more here.

      If you want to look at .appx deployment then you must read this article.

      Note: There might be mistakes when gathering this information. So I will be very happy if you drop your feedback about this article.

Read the original article from here.

Have a nice day by Subramanyam Raju :)

Up Next
    Ebook Download
    View all
    Learn
    View all