Home > Software engineering >  how to adapt android manifest to UWP manifest in a xamarin solution
how to adapt android manifest to UWP manifest in a xamarin solution

Time:09-23

I'm trying to build my first xamarin app. I'm completely new / green to xamarin and uwp. I'm following the tutorial here: https://www.youtube.com/watch?v=9opLnX4G9EQ And the code can be found here: https://github.com/sinhakislay/MSGraphXamarin

I'm trying to adapt this example for a UWP client instead of android. I'm at the point in the video (15 minutes 10 seconds in). where he shows how to edit the manifest file to specify the "msauth" scheme and the hostname. But I'm not sure how to do the same thing for my UWP app. Here's his code:

<?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="com.companyname.MSGraphXamarin">
    <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
    <application android:label="MSGraphXamarin.Android">
        <activity android:name="microsoft.identity.client.BrowserTabActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="msauth" android:host="com.companyname.MSGraphXamarin" />
            </intent-filter>
        </activity>
    </application>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

And here's what I have so far in the Default.rd.xml file:

<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
  <Application>
    <!--
      An Assembly element with Name="*Application*" applies to all assemblies in
      the application package. The asterisks are not wildcards.
    -->
    <Assembly Name="*Application*" Dynamic="Required All" />
    
    <!-- Add your application specific runtime directives here. -->

  </Application>
</Directives>

I tried to copy just the * into the section, but it complains that it doesn't know what the "android" namespace is. I'm trying to crash course myself now on what manifests actually are / how they work. but any tips would be appreciated.

CodePudding user response:

You have to take into account that every type of platform is different. Android usually is the most annoying when talking about permissions, and has to be specified inside the manifest.

You should not try to "translate" the android.manifest to another platform, as each one is different.

This might be helpful

  • Related