Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to discovering activity-alias activity elements (#247)
Context https://developer.android.com/guide/topics/manifest/activity-alias-element. Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/2305723. So activity-alias allows users to change some settings before calling an activity. The idea is that your activity is no longer the main launcher, you still have that entry, but the activity-alias' become the main launchers. Here is a sample AndroidManifest.xml ```xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"> <activity-alias android:name=".MainActivityAlias" android:enabled="true" android:icon="@mipmap/appicon" android:targetActivity=".MainActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity-alias> <activity-alias android:name=".MainActivityAlias2" android:enabled="false" android:icon="@mipmap/appicon2" android:targetActivity=".MainActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity-alias> </application> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> </manifest> ``` The MainActivity.cs then becomes ```csharp [Activity(Theme = "@style/Maui.SplashTheme", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] [Register("com.companyname.mauiappwithmultipleicons.MainActivity")] public class MainActivity : MauiAppCompatActivity ``` Note that we do not use the MainLauncher property on the ActivityAttribute.
- Loading branch information