Friday, January 17, 2014

Tutorial 3 - Changing Our Manifest

One of the strangest (in my mind anyway) aspects of Dot42 is the lack of direct interaction with the AndroidManifest.xml file.  The manifest file is generated from tags placed in your code files.  Unlike the other .xml resource files, you cannot simply copy and paste the code from the tutorial.  This one takes a little work.

The changes I made to the manifest in this project are wider reaching than the couple of changes in the BC Guide.  I made an attempt to match my generated file with the one from the tutorial project.  Even though the project would compile and run just fine without the additions, I thought it was worthwhile to illustrate as much of the manifest options as I could.

To start, I added the Supported Screens section as indicated in the tutorial.  I added an [assembly:] tag that looks like this: [assembly: SupportsScreens(LargeScreens=true, NormalScreens=true, SmallScreens=false, XLargeScreens=true)].  The next part of the tutorial is the min and target SDK section.  As best I can tell, the only way to accomplish this is in the Project->Properties menu.

The rest of the changes I made were aimed at providing explicit translation from the tutorial AndroidManifest.xml file.  This required adding parameters to the [assembly: Application()] tag.  These parameters correspond to the attributes in the <application> section of the manifest file.  I could not find a parameter for android:allowBackup, but the others were fairly self explanatory.

I had to do some searching for the version information.  It seemed that this info would be in the Project->Properties menu along with the SDK options and package name, but thanks to StackOverflow, I found out that there is an [assembly: Package()] tag and that is where versionCode and versionName are located.

The [Activity] tag goes over our activity and I expanded the default to include the Label parameter..  I could not find information of the Name parameter.  Although it is unnecessary now, I included the [IntentFilter] tag and I am glad I did because the implementation has been changed since the Manifest guide was updated on the Dot42 website.  In the guide it looks like actions and categories were members of an enumeration.  Now they are string[].  I like this better, because it allows you to use the strings that you would find in ordinary Android tutorials.

Well, that wraps up the 3rd tutorial.  I admit that this one had me looking up information more than the previous ones.  If I remember correctly, the next one will be a bit easier.

No comments:

Post a Comment