On Jul 25, 2012, at 1:57 PM, Neal Culiner <[email protected]> wrote:
> However, to get support for the newer features, as you know, I had to set the 
> Minimum Android to Target to 4.0.  I then saw that the package that was sent 
> to my device and later an emulator was a higher package version.

I'm not sure I understand this sentence; _what_ was "a higher package version"?

The TargetFrameworkVersion[0] that your app is built against corresponds to an 
API level, e.g. selecting "Android 2.3 (Gingerbread)" corresponds to API level 
10. When the app is deployed, a Mono.Android.Platform.ApiLevel_X package is 
deployed to the target, where X is the TargetFrameworkVersion's API level.

TargetFrameworkVersion controls which types and members the compiler will 
permit access to.

There is also the AndroidManifest.xml //uses-sdk/@android:minSdkVersion 
attribute (MonoDevleop: Project Options > Build/Mono for Android Application > 
Minimum Android Version). This tells Android what the minimum API level your 
application will target. If not specified, this defaults to 
$(TargetFrameworkVersion).

Finally there is the AndroidManifest.xml //uses-sdk/@android:targetSdkVersion 
attribute [1], which Android uses to enable/disable certain default behaviors, 
in addition to which android.jar your application is built against. If not 
specified, this also defaults to $(TargetFrameworkVersion).

> This leads me to believe I should use the max version in my project to code 
> against and this will also send the latest package to the device to use.

There are two different possible max values, which control different things: 
TargetFrameworkVersion and targetSdkVersion.

TargetFrameworkVersion should be the maximum API level that you wish to target.

targetSdkVersion should be ignored unless you're using something that requires 
it be set to a different value (e.g. Admob, which requires API 13 no matter 
what API level your app actually targets).

> With this being said, I suggest we adopt the same thing MonoTouch adopted for 
> the SDK version with the term “Default” which uses the latest available API 
> installed on the machine or you can set it to a lower version as needed.

I'm not sure this is a good idea. (I'm not sure what we currently do is best 
either, for that matter.)

MonoTouch is not Mono for Android. MonoTouch ships with a single binding 
assembly, and it's up to the developer to (somehow) ensure that they only use 
members that exist on their target devices.

Mono for Android, meanwhile, ships with one binding assembly per API level 
(Mono.Android.dll/etc.). This allows the compiler+IDE to only show the desired 
types and members.

The problem is that our installer installs _lots_ of API levels, including 
API-15, which has 10.7% market share.

        http://developer.android.com/about/dashboards/index.html

In the future our installer will likely install API-16, which will have even 
less.

I'm not sure it's a good idea to default to an API level that hardly anyone 
has, unless the developer actually has such a device. Compare to iOS, where iOS 
5.1 got 61% adoption in 15 days; fragmentation is a reality.

        
http://thenextweb.com/apple/2012/03/23/apples-ota-upgrade-process-and-focused-hardware-lets-ios-5-1-hit-61-adoption-in-15-days/

(Granted, the current solution of "default to API level 8" isn't wonderful 
either...)

 - Jon

[0] TargetFrameworkVersion is set in Visual Studio at Project Properties > 
Application > Minimum Android to target.

TargetFrameworkVersion is set within MonoDevelop at Project Options > 
Build/General > Target framework.

[1] //uses-sdk/@android:targetSdkVersion is set in Visual Studio at Project 
Properties > Android Manifest > Target API level.

//uses-sdk/@android:targetSdkVersion is set in MonoDevelop at Project Options > 
Build/Mono for Android Application > Target Android version.
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to