Skip to content

Commit

Permalink
Move sample out of docs repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark McLemore committed Dec 11, 2015
1 parent a43953c commit 3ead8f6
Show file tree
Hide file tree
Showing 15 changed files with 228 additions and 0 deletions.
16 changes: 16 additions & 0 deletions HelloWorldPublishing/HelloWorld.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Mono.Samples.HelloWorld
{
using Android.App;
using Android.OS;

[Activity(Label = "Hello World Demo", MainLauncher = true)]
public class HelloAndroid : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);

SetContentView(Resource.Layout.main);
}
}
}
74 changes: 74 additions & 0 deletions HelloWorldPublishing/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{60F4286E-BC72-4C35-A584-018508BF4291}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Mono.Samples.HelloWorld</RootNamespace>
<AssemblyName>mono.samples.helloworld</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidApplication>true</AndroidApplication>
<AndroidSupportedAbis>armeabi-v7a</AndroidSupportedAbis>
<MandroidI18n />
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MonoDroidLinkMode>None</MonoDroidLinkMode>
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidStoreUncompressedFileExtensions>
</AndroidStoreUncompressedFileExtensions>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="HelloWorld.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\icon.png" />
<AndroidResource Include="Resources\drawable-ldpi\icon.png" />
<AndroidResource Include="Resources\layout\main.xml" />
<AndroidResource Include="Resources\drawable-mdpi\icon.png" />
<AndroidResource Include="Resources\values\strings.xml" />
</ItemGroup>
<ItemGroup>
<TransformFile Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
22 changes: 22 additions & 0 deletions HelloWorldPublishing/HelloWorld.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld.csproj", "{60F4286E-BC72-4C35-A584-018508BF4291}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{60F4286E-BC72-4C35-A584-018508BF4291}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60F4286E-BC72-4C35-A584-018508BF4291}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60F4286E-BC72-4C35-A584-018508BF4291}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{60F4286E-BC72-4C35-A584-018508BF4291}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60F4286E-BC72-4C35-A584-018508BF4291}.Release|Any CPU.Build.0 = Release|Any CPU
{60F4286E-BC72-4C35-A584-018508BF4291}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
11 changes: 11 additions & 0 deletions HelloWorldPublishing/Metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<SampleMetadata>
<ID>E5D0D92C-9B55-461F-9119-45C9A405E105</ID>
<IsFullApplication>false</IsFullApplication>
<Brief>Simple project containing a keystore</Brief>
<Level>Intermediate</Level>
<LicenseRequirement>Indie</LicenseRequirement>
<Tags>Getting Started</Tags>
<SupportedPlatforms>Android</SupportedPlatforms>
<Gallery>false</Gallery>
</SampleMetadata>
5 changes: 5 additions & 0 deletions HelloWorldPublishing/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mono.samples.helloworld" android:installLocation="internalOnly">
<application android:label="mono.android.helloworld" />
<uses-sdk android:targetSdkVersion="21" android:minSdkVersion="19" />
</manifest>
43 changes: 43 additions & 0 deletions HelloWorldPublishing/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

using Android.App;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle ("HelloWorld")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Novell")]
[assembly: AssemblyProduct ("HelloWorld")]
[assembly: AssemblyCopyright ("Copyright © Novell 2010")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible (false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid ("a557ce8c-9dbe-4b93-8fc4-95ffc126cf14")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ("1.0.0.0")]
[assembly: AssemblyFileVersion ("1.0.0.0")]
#if RELEASE
[assembly: Application(Debuggable=false, Icon="@drawable/icon")]
#else
[assembly: Application(Debuggable = true, Icon = "@drawable/icon")]
#endif
13 changes: 13 additions & 0 deletions HelloWorldPublishing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Hello World (Publishing)
========================

This is a simple hello world type application to that goes along with
the Xamarin topic
[Publishing an Application](http://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/).

This project contains a sample keystore called `xample.keystore`. This
keystore is only for demonstration purposes. Do not use it for anything
other thank example purposes. The password is `password`, and the
keystore contains one key named `publishingdoc` with the password of
`password`.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions HelloWorldPublishing/Resources/layout/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
5 changes: 5 additions & 0 deletions HelloWorldPublishing/Resources/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloAndroid!</string>
<string name="app_name">Hello, Android</string>
</resources>
Binary file added HelloWorldPublishing/Screenshots/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions HelloWorldPublishing/build_and_sign_for_release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This is a sample Powershell script for compiling, signing, and then zipaliging a Mono for Android APK file.
# This does assume that the JDK and the Android SDK are in their default locations, and that the necessary changes have
# be made to the Release build target in VS2010.
#
# This script also assumes that there is a keystore file name xample.keystore.
#
# The signed and zipaligned APK will be found in ./helloworld.apk.

#### BEGIN BUILDING
# First clean the Release target.
msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:Clean

# Now build the project, using a the Release target.
msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:PackageForAndroid

# At this point there is only the unsigned APK - sign it.
# The script will pause here as jarsigner prompts for the password.
# It is possible to provide they keystore password for jarsigner.exe by adding an extra command line parameter -storepass, for example
# -storepass <MY_SECRET_PASSWORD>
# If this script is to be checked in to source code control then it is not recommended to include the password as part of this script.
& 'C:\Program Files\Java\jdk1.6.0_24\bin\jarsigner.exe' -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore ./xample.keystore -signedjar ./bin/Release/mono.samples.helloworld-signed.apk ./bin/Release/mono.samples.helloworld.apk publishingdoc

# Now zipalign it. The -v parameter tells zipalign to verify the APK afterwards.
& 'C:\Program Files\Android\android-sdk\tools\zipalign.exe' -f -v 4 ./bin/Release/mono.samples.helloworld-signed.apk ./helloworld.apk

# Done! Do a quick list of APK's in this directory.
ls *.apk
Binary file added HelloWorldPublishing/xample.keystore
Binary file not shown.

0 comments on commit 3ead8f6

Please sign in to comment.