In Visual Studio, une the Properties/AndroidManifest.xml file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:installLocation="auto" android:versionName="1.0">
<uses-sdk />
<application android:label="Aftermath" android:largeHeap="true">
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /></application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
However, after installation on a device, when I check my application's manifest using the manifestViewer app (available on the playstore), the manifest is completly different and looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="Aftermath.Aftermath">
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15"/>
<application
android:icon="@2130837644"
android:name="mono.android.app.Application"
android:debuggable="true">
<activity
android:name="androclient.activities.AftermathActivity"
android:screenOrientation="landscape"/>
<activity
android:label="Aftermath"
android:icon="@2130837644"
android:name="androclient.activities.TitleScreenActivity"
android:screenOrientation="landscape">
<intent-filter>
<action
android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<provider
android:name="mono.MonoRuntimeProvider"
android:exported="false"
android:authorities="Aftermath.Aftermath.mono.MonoRuntimeProvider.__mono_init__"
android:initOrder="2147483647"/>
<receiver
android:name="mono.android.Seppuku">
<intent-filter>
<action
android:name="mono.android.intent.action.SEPPUKU"/>
<category
android:name="mono.android.intent.category.SEPPUKU.Aftermath.Aftermath"/>
</intent-filter>
</receiver>
</application>
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
Is this normal ? How can I edit the manifest to include application attributes, meta-data and activities ?
Thanks
Xamarin uses Attributes
in code to fill in the Android Manifest when building. You can use Attributes
for Activity
, Service
, BroadcastReceiver
, IntentFilter
, Application
, MetaData
etc.
So if you have a BroadcastReceiver
like this in Xamarin
[BroadcastReceiver]
[IntentFilter(new string[] { "com.example.filter" }]
public class BR : BroadcastReceiver {}
You'll get an addition to the generated manifest with your BroadcastReceiver
and IntentFilter
.
Or an Activity such as
[Activity(MainLauncher = true, ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait)]
public class MainActivity : Activity {}
Or in your Application class
[Application(Theme = "@style/AppTheme", Icon = "@drawable/icon")]
public class App : Application
All of these will be included in the generated Android Manifest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With