Google WP8.0 vs WP8.1 :All about new package.appxmanifest file at beginners level | SubramanyamRaju Xamarin & Windows App Dev Tutorials

Friday 18 July 2014

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

Introduction:

I believe you may already known about new windowsphone 8.1 sdk that is now old windowsphone 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.

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:




After double click on a file,you will be find tab designer like this
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
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.
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
  • Toast capable:Toast displays at the top of the screen to notify users of an event, such as a new email alert which 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 having two values "Yes" or "No"  to enable/disable 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 he user should be aware of.And this option having two values "Yes" or "No"  to enable/disable lock notification from your app.
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.

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 .

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.

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:

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:

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.
Finally in your side, you have to handle the ScriptNotify event, retrieve the data that is being sent.
For example:

Xaml:

C#:
3.7)Packaging Tab:
Finally this tab is used for Set the properties that are used to package your app.
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.


Follow me always at  
Have a nice day by  :)

2 comments:

  1. Hello Subbu,

    I want to get installed Apps in my App.I checked it but unfortunately i didn't get anything.Is there any way to do this?
    Please give some suggestions.

    Thank you.

    ReplyDelete
  2. hi subbu,
    When I open the packge.appxmanifest file in visual studio 2015 at that time I got the exception like "unable to load one or more requsted types".
    please give me a suggestions:

    Thanks,
    Pradeep

    ReplyDelete

Search Engine Submission - AddMe