Skip to content

Commit

Permalink
Merge pull request #47 from dzoech/make-android-launcher-name-and-pac…
Browse files Browse the repository at this point in the history
…kage-configurable-2

Make Android launcher name and package name configurable to distinguish between debug and release builds
  • Loading branch information
dzoech authored Aug 6, 2022
2 parents 19acf6d + 5a4417d commit fbc69ec
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/Nudelsieb/Nudelsieb.Mobile.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_misc", "_misc", "{475A8799
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
CodeMaid.config = CodeMaid.config
Nudelsieb.Mobile\readme.md = Nudelsieb.Mobile\readme.md
stylecop.json = stylecop.json
EndProjectSection
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

namespace Nudelsieb.Mobile.Droid
{
// 1 to have it at the top of all apps when debugging
[Activity(Label = "1 Nudelsieb", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
[Activity(Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@
<RootNamespace>Nudelsieb.Mobile.Droid</RootNamespace>
<AssemblyName>Nudelsieb.Mobile.Android</AssemblyName>
<Deterministic>True</Deterministic>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<AndroidManifestPlaceholders>identityClientId=6ea4a837-1b3b-483f-aaeb-e7a96d56d4d9</AndroidManifestPlaceholders>
<!-- IntermediateOutputPath fixes MAX_PATH length issue when building an archive locally: -->
<IntermediateOutputPath>C:/nds</IntermediateOutputPath>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -39,6 +23,8 @@
<AndroidLinkMode>None</AndroidLinkMode>
<MandroidI18n />
<AndroidSupportedAbis />
<AppPackageNamePostFix>.debug</AppPackageNamePostFix>
<AppDisplayName>1 Nudelsieb Debug</AppDisplayName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
Expand All @@ -52,6 +38,26 @@
<AndroidLinkTool>r8</AndroidLinkTool>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidKeyStore>false</AndroidKeyStore>
<AppPackageNamePostFix></AppPackageNamePostFix>
<AppDisplayName>Nudelsieb</AppDisplayName>
</PropertyGroup>
<PropertyGroup>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<AndroidManifestPlaceholders>identityClientId=6ea4a837-1b3b-483f-aaeb-e7a96d56d4d9;packagePostFix=$(AppPackageNamePostFix);displayName=$(AppDisplayName)</AndroidManifestPlaceholders>
<!-- IntermediateOutputPath fixes MAX_PATH length issue when building an archive locally: -->
<IntermediateOutputPath>C:/nds</IntermediateOutputPath>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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="dev.zoechbauer.nudelsieb" android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="dev.zoechbauer.nudelsieb${packagePostFix}" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<application android:label="Nudelsieb" android:theme="@style/MainTheme" android:icon="@drawable/icon">
<application android:label="${displayName}" android:theme="@style/MainTheme" android:icon="@drawable/icon">
<activity android:name="microsoft.identity.client.BrowserTabActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand Down

This file was deleted.

9 changes: 9 additions & 0 deletions src/Nudelsieb/Nudelsieb.Mobile/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Nudelsieb.Mobile setup

## Building the Xamarin.Android app

Go to the [Firebase console](https://console.firebase.google.com/project/nudelsieb-mobile/settings/general/android:dev.zoechbauer.nudelsieb) and download the `google-services.json`. This contains `client` entries for `dev.zoechbauer.nudelsieb` as well as `dev.zoechbauer.nudelsieb.debug`. The latter is used to install debug builds from the IDE on your phone without replacing a release version installed from an APK.

Either copy your `google-services.json` into the project's root directory next to `Nudelsieb.Mobile.Android.csproj` or use the MSBuild argument `/p:GoogleServicesJsonFilePath=myFilePath` to read the file from a different location.

In `Nudelsieb.Mobile.Android.csproj` several variables are set depending if the build uses a Release or Debug configuration. These variables are then used in `Properties\AndroidManifest.xml`.

0 comments on commit fbc69ec

Please sign in to comment.