Share via


WP8.0 vs WP8.1 :All about new package.appxmanifest file at beginners level

Introduction

I believe you may already known about new windows phone 8.1 sdk that is now old windows phone 8.0 "WMAppManifest.xml" file is renamed to "Package.appxmanifest" which is very similar to the Windows Store apps . Package.appxmanifest is xml file that included all info of our application such as targeted app OS version,App display name,App icons,capability permissions to run app,Start page to be App launch..etc .And every app package must have one package manifest file and off-course by default it is created by Visual Studio 2013 when you create new app. Ok lets see below image to understand how many new tabs are added in new package manifest file.

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F--Z61t79R9V4%2FU8jFCtWHteI%2FAAAAAAAAA_Q%2Fc3nA-jHMHWE%2Fs1600%2FSecond.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

Requirements to work with this post:

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

Description:

1)What is the actual role of Package.appxmanifest?
**
**

When we run the our app.during the compilation process app package will be installed with file extension of .appx(Note: Now isn’t a XAP anymore),So its time to role of Package.appxmanifest which can introduces your app to the phone like this 

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

2)How can i open package.appxmanifest file in windowsphone store?

You can find package.appxmanifest file in your project solution explorer.And you can open this by two ways 

2.1)Tab designer mode:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-V7lYb-XD90I%2FU8jMic46xZI%2FAAAAAAAAA_g%2FFsVyKNT2rX0%2Fs1600%2FSolutionExplorer.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

After double click on a file,you will be find tab designer like this

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-bu3Q9_yrZOA%2FU8jM-RNNIPI%2FAAAAAAAAA_o%2FEh3yOgn_UZI%2Fs1600%2FPackage.appxmanifest.jpg&container=blogger&gadget=a&rewriteMime=image%2F*

2.2)Xml Editor mode:

As we already discussed in "Introduction" section,package.appxmanifest file is an xml document,but above designer mode is light weight process to work and that's having simplicity.Ok ok to open file in xml editor mode right click on "package.appxmanifest" file from solution explorer=>select open with=>you will find dialog ,select XML(Text) Editor.So you will find package.appxmanifest file like this

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-cdeMMFiCIDw%2FU8jimD3GHsI%2FAAAAAAAAA_4%2Ff50wdaMQ1KU%2Fs1600%2Fappxml.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

**Note:**Don't be edit this file,if you want to make any changes close this xml mode and then please open file in above designer mode and edit it as per your needs. 

3)What are the new tabs in package.appxmanifest file?
**
**

This is the most important section,please see in top of this post,there is one image in "Introduction" section.I hope with reference to that image you are getting idea about how many extra tabs available in package.appxmanifest file.So in new package.appxmanifest file there is seven tabs are available

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

3.1)Application tab:

This is very important tab,that describes basic info our application.

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-gWjeLTblAeo%2FU8j3BUzS22I%2FAAAAAAAABAY%2FWsMomV9ZUXI%2Fs1600%2FPackage.appxmanifest.jpg&container=blogger&gadget=a&rewriteMime=image%2F*

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 in wp8.1 sdk).

**Notification Settings:**For enable/disable Toast/Lock Notifications

3.2)Visual Assets tab:

This tab is entirely related to app logos,splash-screen images,Tile/Lock screen notification logos and Store Logos.And make sure you have different sized image which are mentioned.

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-nxrAv2CJdKE%2FU8j7836TYlI%2FAAAAAAAABAs%2FVZLA7OvlHhE%2Fs1600%2FVisualAssets.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

3.3)Requirements tab:

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

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-XS3bboUdlyY%2FU8kBBKl8BxI%2FAAAAAAAABA8%2FsN4PNAJUDS4%2Fs1600%2FRequirments.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

3.4)Capabilities Tab:

While accessing any private information of user device,your app must ask to user permissions.Suppose if your app is trying to get phone contacts,then you must be enable "Contacts" option from capabilities tab.Otherwise you would be get an exception like "unauthorized".And read more here.

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-0UjuDHSk8Zo%2FU8kENoB729I%2FAAAAAAAABBI%2Fh8sozsorWUI%2Fs1600%2FCababilities.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

3.5)Declarations Tab:

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

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-SgTmfkHFI6o%2FU8kI37UxsbI%2FAAAAAAAABBU%2F3wa40q0D3Vg%2Fs1600%2FDeclarations.jpg&container=blogger&gadget=a&rewriteMime=image%2F*

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

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F3.bp.blogspot.com%2F-TNHHXUY0uHU%2FU8kJ_HZfpgI%2FAAAAAAAABBg%2FR0TslNA-93w%2Fs1600%2FShareTarget.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

Inside args.ShareOperation.Data there are many function 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.:

3.6)Content URIs Tab:

Have you heard about command "window.external.notify" in javascript which is useful for running external website which pass date to our app.So it is best practices if you have to indicate which URI’s you want to allow to pass information into your app on this page, and it has to be one with an SSL certificate.

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F1.bp.blogspot.com%2F-LAQYpCPoXhw%2FU8kQi9YZxbI%2FAAAAAAAABBw%2FAWRR59icSnI%2Fs1600%2FContent%2BURIs.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

Finally in your side, you have to handle the ScriptNotify event, retrieve the data that is being sent.

For example:

Xaml:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-p8LhY0qX-t0%2FU8kR14WvZsI%2FAAAAAAAABCA%2FZmHUPXOjmqI%2Fs1600%2FWebView.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

C#:

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-OZgOMbO5ldc%2FU8kR17njcZI%2FAAAAAAAABCE%2FRWAnRhKbPWA%2Fs1600%2FWebView1.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

3.7)Packaging Tab:

Finally this tab is used for Set the properties that are used to package your app.

https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-i-urKhJruDk%2FU8kUuJ352lI%2FAAAAAAAABCQ%2F6S1lrliPQtQ%2Fs1600%2FPackaging.PNG&container=blogger&gadget=a&rewriteMime=image%2F*

Observe in below there is an option for set app "Bundle" that is having 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 looking for .appx deployment.You must read this post.

**Note:**It may chance to any mistakes while gathering this information.So i will be very happy if you drop your feedback about this post.

Author: SubramanyamRaju
Blog: http://bsubramanyamraju.blogspot.in/