[mono-android] dynamically target Kindle Fire from same project

Jonathan Pobst monkey at jpobst.com
Sun Jan 15 16:43:30 UTC 2012


We also now support declaring permission in code, so you can use defines:

#if !KINDLE
[assembly: UsesPermission (Android.Manifest.Permission.Internet)]
#endif

But I am guessing the actual issue you are hitting is that referencing 
the GoogleMaps assembly automatically adds the <uses-library> to your 
manifest.

So you would need to use conditions like JonP suggests, but on the 
<Reference> to the GoogleMaps.dll instead, and not reference the library 
on Kindle builds.

Jonathan


On 1/15/2012 10:33 AM, Jonathan Pryor wrote:
> On Jan 14, 2012, at 12:11 PM, Gerry High wrote:
>> I'd like my monodroid app to be able to run on the Kindle Fire and as such I need to be able to turn off Google maps.  Short of creating a new project is there a way to tie the android manifest settings (e.g. ACCESS_COURSE_LOCATION, ACCESS_FINE_LOCATION) to a build configuration?
>
> _Probably_. This is untested, but you could presumably edit your Project.csproj and add a Condition attribute to the the<AndroidManifest/>  element:
>
> 	<PropertyGroup>
> 		<!-- ... -->
> 		<AndroidManifest Condition="'$(TargetKindle)'== 'True'">KindleManifest.xml</AndroidManifest>
> 		<AndroidManifest Condition="'$(TargetKindle)'== ''">AndroidManifest.xml</AndroidManifest>
> 	</PropertyGroup>
>
> Then you could set the TargetKindle property when building your project to select the KindleManifest.xml file:
>
> 	msbuild /t:SignAndroidPackage /p:TargetKindle=True Project.csproj ...
>
> However, I have no idea what doing this will do to IDE support for editing the AndroidManifest.xml file; it may break.
>
> (The "silly" MSBuild ideas that come to mind...)
>
>   - Jon
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>



More information about the Monodroid mailing list