Upgrade Android sample app to .net6.0

This commit is contained in:
Morten Nielsen 2023-08-04 10:01:26 -07:00
parent 79e9226da4
commit 9e84b9eb81
9 changed files with 238 additions and 893 deletions

View file

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="SampleApp.Droid.SampleApp.Droid" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<application android:allowBackup="true" android:label="@string/app_name"></application>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<application android:allowBackup="true" android:label="@string/app_name" android:supportsRtl="true"></application>
<uses-sdk />
</manifest>

View file

@ -1,181 +1,178 @@
using Android.App;
using Android.Widget;
using Android.OS;
using Android;
using Android.Support.V4.App;
using Android.Support.V4.Content;
using Android.Content.PM;
using System;
using System.Collections.Generic;
using System.Linq;
using NmeaParser.Messages;
using AndroidX.Core.App;
namespace SampleApp.Droid
namespace SampleApp.Droid;
[Activity(Label = "@string/app_name", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
[Activity(Label = "NMEA Parser SampleApp", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
private Button startButton;
private Button stopButton;
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);
startButton = FindViewById<Button>(Resource.Id.startButton)!;
startButton.Click += StartButton_Click;
stopButton = FindViewById<Button>(Resource.Id.stopButton)!;
stopButton.Click += StopButton_Click;
stopButton.Enabled = false;
devices.Add("System GPS", null);
var devicePicker = FindViewById<Spinner>(Resource.Id.device_picker);
if (this.ApplicationContext!.CheckSelfPermission(Manifest.Permission.BluetoothConnect) != Permission.Granted)
{
ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.BluetoothConnect }, 1000);
return;
}
foreach (var d in NmeaParser.BluetoothDevice.GetBluetoothSerialDevices())
{
devices[d.Name + " " + d.Address] = d.Address;
}
devicePicker.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, devices.Keys.ToArray());
devicePicker.SetSelection(0);
}
private Dictionary<string, string?> devices = new Dictionary<string, string?>();
private void StopButton_Click(object? sender, EventArgs e)
{
private Button startButton;
private Button stopButton;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
startButton = FindViewById<Button>(Resource.Id.startButton);
startButton.Click += StartButton_Click;
stopButton = FindViewById<Button>(Resource.Id.stopButton);
stopButton.Click += StopButton_Click;
stopButton.Enabled = false;
devices.Add("System GPS", null);
var devicePicker = FindViewById<Spinner>(Resource.Id.device_picker);
foreach(var d in NmeaParser.BluetoothDevice.GetBluetoothSerialDevices())
{
devices[d.Name + " " + d.Address] = d.Address;
}
devicePicker.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, devices.Keys.ToArray());
devicePicker.SetSelection(0);
}
private Dictionary<string, string> devices = new Dictionary<string, string>();
private void StopButton_Click(object sender, EventArgs e)
{
if (listener?.IsOpen == true)
{
Stop();
}
}
private void Stop()
{
listener.MessageReceived -= Listener_MessageReceived;
monitor.LocationChanged -= Monitor_LocationChanged;
socket?.Close();
socket?.Dispose();
socket = null;
_ = listener.CloseAsync();
listener = null;
startButton.Enabled = !(stopButton.Enabled = false);
}
private void StartButton_Click(object sender, EventArgs e)
{
if (listener?.IsOpen != true)
{
Start();
}
}
private NmeaParser.NmeaDevice listener;
private NmeaParser.Gnss.GnssMonitor monitor;
private TextView status;
private bool launched;
private Android.Bluetooth.BluetoothSocket socket;
private async void Start()
{
startButton.Enabled = false;
status = FindViewById<TextView>(Resource.Id.output);
var devicePicker = FindViewById<Spinner>(Resource.Id.device_picker);
var id = devicePicker.SelectedItem.ToString();
var btAddress = devices[id];
if (btAddress == null)
{
if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) != Permission.Granted)
{
ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.AccessFineLocation }, 1000);
return;
}
if (launched)
return;
launched = true;
listener = new NmeaParser.SystemNmeaDevice(ApplicationContext);
}
else //Bluetooth
{
try
{
status.Text = "Opening bluetooth...";
var adapter = Android.Bluetooth.BluetoothAdapter.DefaultAdapter;
var bt = Android.Bluetooth.BluetoothAdapter.DefaultAdapter.GetRemoteDevice(btAddress);
Java.Util.UUID SERIAL_UUID = Java.Util.UUID.FromString("00001101-0000-1000-8000-00805F9B34FB"); //UUID for Serial Device Service
socket = bt.CreateRfcommSocketToServiceRecord(SERIAL_UUID);
try
{
await socket.ConnectAsync();
}
catch(Java.IO.IOException)
{
// This sometimes fails. Use fallback approach to open socket
// Based on https://stackoverflow.com/a/41627149
socket.Dispose();
var m = bt.Class.GetMethod("createRfcommSocket", new Java.Lang.Class[] { Java.Lang.Integer.Type });
socket = m.Invoke(bt, new Java.Lang.Object[] { 1 }) as Android.Bluetooth.BluetoothSocket;
socket.Connect();
}
listener = new NmeaParser.StreamDevice(socket.InputStream);
}
catch(System.Exception ex)
{
socket?.Dispose();
socket = null;
status.Text += "\nError opening Bluetooth device:\n" + ex.Message;
}
}
if (listener != null)
{
listener.MessageReceived += Listener_MessageReceived;
status.Text += "\nOpening device...";
await listener.OpenAsync();
status.Text += "\nConnected!";
startButton.Enabled = !(stopButton.Enabled = true);
monitor = new NmeaParser.Gnss.GnssMonitor(listener);
monitor.LocationChanged += Monitor_LocationChanged;
}
else
{
startButton.Enabled = !(stopButton.Enabled = false);
}
}
protected override void OnDestroy()
if (listener?.IsOpen == true)
{
Stop();
base.OnDestroy();
}
protected override void OnResume()
{
base.OnResume();
// if it was resumed by the GPS permissions dialog
//Start();
}
Queue<NmeaParser.Messages.NmeaMessage> messages = new Queue<NmeaParser.Messages.NmeaMessage>(100);
private void Listener_MessageReceived(object sender, NmeaParser.NmeaMessageReceivedEventArgs e)
{
var message = e.Message;
RunOnUiThread(() =>
{
if (messages.Count == 100) messages.Dequeue();
messages.Enqueue(message);
status.Text = string.Join("\n", messages.Reverse().Select(n=>n.ToString()));
});
}
private void Monitor_LocationChanged(object sender, EventArgs e)
{
FindViewById<TextView>(Resource.Id.latitude).Text = "Latitude = " + monitor.Latitude.ToString("0.0000000");
FindViewById<TextView>(Resource.Id.longitude).Text = "Longitude = " + monitor.Longitude.ToString("0.0000000");
FindViewById<TextView>(Resource.Id.altitude).Text = "Altitude = " + monitor.Altitude.ToString();
}
}
}
private void Stop()
{
listener!.MessageReceived -= Listener_MessageReceived;
monitor!.LocationChanged -= Monitor_LocationChanged;
socket?.Close();
socket?.Dispose();
socket = null;
_ = listener.CloseAsync();
listener = null;
startButton.Enabled = !(stopButton.Enabled = false);
}
private void StartButton_Click(object? sender, EventArgs e)
{
if (listener?.IsOpen != true)
{
Start();
}
}
private NmeaParser.NmeaDevice? listener;
private NmeaParser.Gnss.GnssMonitor? monitor;
private TextView? status;
private bool launched;
private Android.Bluetooth.BluetoothSocket? socket;
private async void Start()
{
startButton.Enabled = false;
status = FindViewById<TextView>(Resource.Id.output);
var devicePicker = FindViewById<Spinner>(Resource.Id.device_picker)!;
var id = devicePicker.SelectedItem?.ToString();
var btAddress = devices[id];
if (btAddress == null)
{
if (this.ApplicationContext!.CheckSelfPermission(Manifest.Permission.AccessFineLocation) != Permission.Granted)
{
ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.AccessFineLocation }, 1000);
return;
}
if (launched)
return;
launched = true;
listener = new NmeaParser.SystemNmeaDevice(ApplicationContext);
}
else //Bluetooth
{
try
{
status.Text = "Opening bluetooth...";
var adapter = Android.Bluetooth.BluetoothAdapter.DefaultAdapter;
var bt = Android.Bluetooth.BluetoothAdapter.DefaultAdapter.GetRemoteDevice(btAddress);
Java.Util.UUID SERIAL_UUID = Java.Util.UUID.FromString("00001101-0000-1000-8000-00805F9B34FB"); //UUID for Serial Device Service
socket = bt.CreateRfcommSocketToServiceRecord(SERIAL_UUID);
try
{
await socket.ConnectAsync();
}
catch (Java.IO.IOException)
{
// This sometimes fails. Use fallback approach to open socket
// Based on https://stackoverflow.com/a/41627149
socket?.Dispose();
var m = bt.Class.GetMethod("createRfcommSocket", new Java.Lang.Class[] { Java.Lang.Integer.Type });
socket = (Android.Bluetooth.BluetoothSocket)m.Invoke(bt, new Java.Lang.Object[] { 1 })!;
socket.Connect();
}
listener = new NmeaParser.StreamDevice(socket.InputStream);
}
catch (System.Exception ex)
{
socket?.Dispose();
socket = null;
status.Text += "\nError opening Bluetooth device:\n" + ex.Message;
}
}
if (listener != null)
{
listener.MessageReceived += Listener_MessageReceived;
status!.Text += "\nOpening device...";
await listener.OpenAsync();
status.Text += "\nConnected!";
startButton.Enabled = !(stopButton.Enabled = true);
monitor = new NmeaParser.Gnss.GnssMonitor(listener);
monitor.LocationChanged += Monitor_LocationChanged;
}
else
{
startButton.Enabled = !(stopButton.Enabled = false);
}
}
protected override void OnDestroy()
{
Stop();
base.OnDestroy();
}
protected override void OnResume()
{
base.OnResume();
// if it was resumed by the GPS permissions dialog
//Start();
}
Queue<NmeaParser.Messages.NmeaMessage> messages = new Queue<NmeaParser.Messages.NmeaMessage>(100);
private void Listener_MessageReceived(object? sender, NmeaParser.NmeaMessageReceivedEventArgs e)
{
var message = e.Message;
RunOnUiThread(() =>
{
if (messages.Count == 100) messages.Dequeue();
messages.Enqueue(message);
status!.Text = string.Join("\n", messages.Reverse().Select(n => n.ToString()));
});
}
private void Monitor_LocationChanged(object? sender, EventArgs e)
{
FindViewById<TextView>(Resource.Id.latitude)!.Text = "Latitude = " + monitor!.Latitude.ToString("0.0000000");
FindViewById<TextView>(Resource.Id.longitude)!.Text = "Longitude = " + monitor!.Longitude.ToString("0.0000000");
FindViewById<TextView>(Resource.Id.altitude)!.Text = "Altitude = " + monitor!.Altitude.ToString();
}
}

View file

@ -1,30 +0,0 @@
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("SampleApp.Droid")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SampleApp.Droid")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// 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")]

View file

@ -0,0 +1,44 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.
For example, a sample Android app that contains a user interface layout (main.xml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:
Resources/
drawable/
icon.png
layout/
main.xml
values/
strings.xml
In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called "Resource"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the Resource class would expose:
public class Resource {
public class Drawable {
public const int icon = 0x123;
}
public class Layout {
public const int main = 0x456;
}
public class Strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
You would then use Resource.Drawable.icon to reference the drawable/icon.png file, or
Resource.Layout.main to reference the layout/main.xml file, or Resource.Strings.first_string
to reference the first string in the dictionary file values/strings.xml.

View file

@ -1,588 +0,0 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::Android.Runtime.ResourceDesignerAttribute("SampleApp.Droid.Resource", IsApplication=true)]
namespace SampleApp.Droid
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.1.0.11")]
public partial class Resource
{
static Resource()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
public static void UpdateIdValues()
{
}
public partial class Attribute
{
// aapt resource value: 0x7F010000
public const int font = 2130771968;
// aapt resource value: 0x7F010001
public const int fontProviderAuthority = 2130771969;
// aapt resource value: 0x7F010002
public const int fontProviderCerts = 2130771970;
// aapt resource value: 0x7F010003
public const int fontProviderFetchStrategy = 2130771971;
// aapt resource value: 0x7F010004
public const int fontProviderFetchTimeout = 2130771972;
// aapt resource value: 0x7F010005
public const int fontProviderPackage = 2130771973;
// aapt resource value: 0x7F010006
public const int fontProviderQuery = 2130771974;
// aapt resource value: 0x7F010007
public const int fontStyle = 2130771975;
// aapt resource value: 0x7F010008
public const int fontWeight = 2130771976;
static Attribute()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Attribute()
{
}
}
public partial class Boolean
{
// aapt resource value: 0x7F020000
public const int abc_action_bar_embed_tabs = 2130837504;
static Boolean()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Boolean()
{
}
}
public partial class Color
{
// aapt resource value: 0x7F030000
public const int notification_action_color_filter = 2130903040;
// aapt resource value: 0x7F030001
public const int notification_icon_bg_color = 2130903041;
// aapt resource value: 0x7F030002
public const int notification_material_background_media_default_color = 2130903042;
// aapt resource value: 0x7F030003
public const int primary_text_default_material_dark = 2130903043;
// aapt resource value: 0x7F030004
public const int ripple_material_light = 2130903044;
// aapt resource value: 0x7F030005
public const int secondary_text_default_material_dark = 2130903045;
// aapt resource value: 0x7F030006
public const int secondary_text_default_material_light = 2130903046;
static Color()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Color()
{
}
}
public partial class Dimension
{
// aapt resource value: 0x7F040000
public const int compat_button_inset_horizontal_material = 2130968576;
// aapt resource value: 0x7F040001
public const int compat_button_inset_vertical_material = 2130968577;
// aapt resource value: 0x7F040002
public const int compat_button_padding_horizontal_material = 2130968578;
// aapt resource value: 0x7F040003
public const int compat_button_padding_vertical_material = 2130968579;
// aapt resource value: 0x7F040004
public const int compat_control_corner_material = 2130968580;
// aapt resource value: 0x7F040005
public const int notification_action_icon_size = 2130968581;
// aapt resource value: 0x7F040006
public const int notification_action_text_size = 2130968582;
// aapt resource value: 0x7F040007
public const int notification_big_circle_margin = 2130968583;
// aapt resource value: 0x7F040008
public const int notification_content_margin_start = 2130968584;
// aapt resource value: 0x7F040009
public const int notification_large_icon_height = 2130968585;
// aapt resource value: 0x7F04000A
public const int notification_large_icon_width = 2130968586;
// aapt resource value: 0x7F04000B
public const int notification_main_column_padding_top = 2130968587;
// aapt resource value: 0x7F04000C
public const int notification_media_narrow_margin = 2130968588;
// aapt resource value: 0x7F04000D
public const int notification_right_icon_size = 2130968589;
// aapt resource value: 0x7F04000E
public const int notification_right_side_padding_top = 2130968590;
// aapt resource value: 0x7F04000F
public const int notification_small_icon_background_padding = 2130968591;
// aapt resource value: 0x7F040010
public const int notification_small_icon_size_as_large = 2130968592;
// aapt resource value: 0x7F040011
public const int notification_subtext_size = 2130968593;
// aapt resource value: 0x7F040012
public const int notification_top_pad = 2130968594;
// aapt resource value: 0x7F040013
public const int notification_top_pad_large_text = 2130968595;
static Dimension()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Dimension()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7F050000
public const int icon = 2131034112;
// aapt resource value: 0x7F050001
public const int notification_action_background = 2131034113;
// aapt resource value: 0x7F050002
public const int notification_bg = 2131034114;
// aapt resource value: 0x7F050003
public const int notification_bg_low = 2131034115;
// aapt resource value: 0x7F050004
public const int notification_bg_low_normal = 2131034116;
// aapt resource value: 0x7F050005
public const int notification_bg_low_pressed = 2131034117;
// aapt resource value: 0x7F050006
public const int notification_bg_normal = 2131034118;
// aapt resource value: 0x7F050007
public const int notification_bg_normal_pressed = 2131034119;
// aapt resource value: 0x7F050008
public const int notification_icon_background = 2131034120;
// aapt resource value: 0x7F050009
public const int notification_template_icon_bg = 2131034121;
// aapt resource value: 0x7F05000A
public const int notification_template_icon_low_bg = 2131034122;
// aapt resource value: 0x7F05000B
public const int notification_tile_bg = 2131034123;
// aapt resource value: 0x7F05000C
public const int notify_panel_notification_icon_bg = 2131034124;
static Drawable()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Drawable()
{
}
}
public partial class Id
{
// aapt resource value: 0x7F060000
public const int action0 = 2131099648;
// aapt resource value: 0x7F060005
public const int actions = 2131099653;
// aapt resource value: 0x7F060001
public const int action_container = 2131099649;
// aapt resource value: 0x7F060002
public const int action_divider = 2131099650;
// aapt resource value: 0x7F060003
public const int action_image = 2131099651;
// aapt resource value: 0x7F060004
public const int action_text = 2131099652;
// aapt resource value: 0x7F060006
public const int altitude = 2131099654;
// aapt resource value: 0x7F060007
public const int async = 2131099655;
// aapt resource value: 0x7F060008
public const int blocking = 2131099656;
// aapt resource value: 0x7F060009
public const int cancel_action = 2131099657;
// aapt resource value: 0x7F06000A
public const int chronometer = 2131099658;
// aapt resource value: 0x7F06000B
public const int device_picker = 2131099659;
// aapt resource value: 0x7F06000C
public const int end_padder = 2131099660;
// aapt resource value: 0x7F06000D
public const int forever = 2131099661;
// aapt resource value: 0x7F06000E
public const int icon = 2131099662;
// aapt resource value: 0x7F06000F
public const int icon_group = 2131099663;
// aapt resource value: 0x7F060010
public const int info = 2131099664;
// aapt resource value: 0x7F060011
public const int italic = 2131099665;
// aapt resource value: 0x7F060012
public const int latitude = 2131099666;
// aapt resource value: 0x7F060013
public const int line1 = 2131099667;
// aapt resource value: 0x7F060014
public const int line3 = 2131099668;
// aapt resource value: 0x7F060015
public const int longitude = 2131099669;
// aapt resource value: 0x7F060016
public const int media_actions = 2131099670;
// aapt resource value: 0x7F060017
public const int normal = 2131099671;
// aapt resource value: 0x7F060018
public const int notification_background = 2131099672;
// aapt resource value: 0x7F060019
public const int notification_main_column = 2131099673;
// aapt resource value: 0x7F06001A
public const int notification_main_column_container = 2131099674;
// aapt resource value: 0x7F06001B
public const int output = 2131099675;
// aapt resource value: 0x7F06001C
public const int right_icon = 2131099676;
// aapt resource value: 0x7F06001D
public const int right_side = 2131099677;
// aapt resource value: 0x7F06001E
public const int startButton = 2131099678;
// aapt resource value: 0x7F06001F
public const int status_bar_latest_event_content = 2131099679;
// aapt resource value: 0x7F060020
public const int stopButton = 2131099680;
// aapt resource value: 0x7F060021
public const int tag_transition_group = 2131099681;
// aapt resource value: 0x7F060022
public const int text = 2131099682;
// aapt resource value: 0x7F060023
public const int text2 = 2131099683;
// aapt resource value: 0x7F060024
public const int time = 2131099684;
// aapt resource value: 0x7F060025
public const int title = 2131099685;
static Id()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Id()
{
}
}
public partial class Integer
{
// aapt resource value: 0x7F070000
public const int cancel_button_image_alpha = 2131165184;
// aapt resource value: 0x7F070001
public const int status_bar_notification_info_maxnum = 2131165185;
static Integer()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Integer()
{
}
}
public partial class Layout
{
// aapt resource value: 0x7F080000
public const int Main = 2131230720;
// aapt resource value: 0x7F080001
public const int notification_action = 2131230721;
// aapt resource value: 0x7F080002
public const int notification_action_tombstone = 2131230722;
// aapt resource value: 0x7F080003
public const int notification_media_action = 2131230723;
// aapt resource value: 0x7F080004
public const int notification_media_cancel_action = 2131230724;
// aapt resource value: 0x7F080005
public const int notification_template_big_media = 2131230725;
// aapt resource value: 0x7F080006
public const int notification_template_big_media_custom = 2131230726;
// aapt resource value: 0x7F080007
public const int notification_template_big_media_narrow = 2131230727;
// aapt resource value: 0x7F080008
public const int notification_template_big_media_narrow_custom = 2131230728;
// aapt resource value: 0x7F080009
public const int notification_template_custom_big = 2131230729;
// aapt resource value: 0x7F08000A
public const int notification_template_icon_group = 2131230730;
// aapt resource value: 0x7F08000B
public const int notification_template_lines_media = 2131230731;
// aapt resource value: 0x7F08000C
public const int notification_template_media = 2131230732;
// aapt resource value: 0x7F08000D
public const int notification_template_media_custom = 2131230733;
// aapt resource value: 0x7F08000E
public const int notification_template_part_chronometer = 2131230734;
// aapt resource value: 0x7F08000F
public const int notification_template_part_time = 2131230735;
static Layout()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Layout()
{
}
}
public partial class String
{
// aapt resource value: 0x7F090000
public const int app_name = 2131296256;
// aapt resource value: 0x7F090001
public const int status_bar_notification_info_overflow = 2131296257;
static String()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private String()
{
}
}
public partial class Style
{
// aapt resource value: 0x7F0A0000
public const int TextAppearance_Compat_Notification = 2131361792;
// aapt resource value: 0x7F0A0001
public const int TextAppearance_Compat_Notification_Info = 2131361793;
// aapt resource value: 0x7F0A0002
public const int TextAppearance_Compat_Notification_Info_Media = 2131361794;
// aapt resource value: 0x7F0A0003
public const int TextAppearance_Compat_Notification_Line2 = 2131361795;
// aapt resource value: 0x7F0A0004
public const int TextAppearance_Compat_Notification_Line2_Media = 2131361796;
// aapt resource value: 0x7F0A0005
public const int TextAppearance_Compat_Notification_Media = 2131361797;
// aapt resource value: 0x7F0A0006
public const int TextAppearance_Compat_Notification_Time = 2131361798;
// aapt resource value: 0x7F0A0007
public const int TextAppearance_Compat_Notification_Time_Media = 2131361799;
// aapt resource value: 0x7F0A0008
public const int TextAppearance_Compat_Notification_Title = 2131361800;
// aapt resource value: 0x7F0A0009
public const int TextAppearance_Compat_Notification_Title_Media = 2131361801;
// aapt resource value: 0x7F0A000A
public const int Widget_Compat_NotificationActionContainer = 2131361802;
// aapt resource value: 0x7F0A000B
public const int Widget_Compat_NotificationActionText = 2131361803;
static Style()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Style()
{
}
}
public partial class Styleable
{
// aapt resource value: { 0x7F010001,0x7F010002,0x7F010003,0x7F010004,0x7F010005,0x7F010006 }
public static int[] FontFamily = new int[] {
2130771969,
2130771970,
2130771971,
2130771972,
2130771973,
2130771974};
// aapt resource value: { 0x1010532,0x1010533,0x101053F,0x7F010000,0x7F010007,0x7F010008 }
public static int[] FontFamilyFont = new int[] {
16844082,
16844083,
16844095,
2130771968,
2130771975,
2130771976};
// aapt resource value: 0
public const int FontFamilyFont_android_font = 0;
// aapt resource value: 2
public const int FontFamilyFont_android_fontStyle = 2;
// aapt resource value: 1
public const int FontFamilyFont_android_fontWeight = 1;
// aapt resource value: 3
public const int FontFamilyFont_font = 3;
// aapt resource value: 4
public const int FontFamilyFont_fontStyle = 4;
// aapt resource value: 5
public const int FontFamilyFont_fontWeight = 5;
// aapt resource value: 0
public const int FontFamily_fontProviderAuthority = 0;
// aapt resource value: 1
public const int FontFamily_fontProviderCerts = 1;
// aapt resource value: 2
public const int FontFamily_fontProviderFetchStrategy = 2;
// aapt resource value: 3
public const int FontFamily_fontProviderFetchTimeout = 3;
// aapt resource value: 4
public const int FontFamily_fontProviderPackage = 4;
// aapt resource value: 5
public const int FontFamily_fontProviderQuery = 5;
static Styleable()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Styleable()
{
}
}
}
}
#pragma warning restore 1591

View file

@ -3,7 +3,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
<TextView
android:id="@+id/longitude"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -38,7 +38,7 @@
android:layout_height="wrap_content">
<Button
android:id="@+id/startButton"
android:layout_width="wrap_content"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="start" />
<Button

View file

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">NMEA Parser SampleApp</string>
</resources>
<resources>
<string name="app_name">NMEA Parser SampleApp</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#2C3E50</color>
</resources>

View file

@ -1,104 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{48540D33-4349-42D2-9D49-144A7049565A}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SampleApp.Droid</RootNamespace>
<AssemblyName>SampleApp.Droid</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</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>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidLinkMode>None</AndroidLinkMode>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>PdbOnly</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>true</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
<TargetFramework>net7.0-android</TargetFramework>
<SupportedOSPlatformVersion>23</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationId>com.companyname.SampleApp.Droid</ApplicationId>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<None Remove="Resources\drawable\icon.png" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.10.1.2" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\AndroidManifest.xml" />
<ProjectReference Include="..\NmeaParser\NmeaParser.csproj" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\Main.axml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\values\Strings.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\" />
<Folder Include="Resources\mipmap-hdpi\" />
<Folder Include="Resources\mipmap-mdpi\" />
<Folder Include="Resources\mipmap-xhdpi\" />
<Folder Include="Resources\mipmap-xxhdpi\" />
<Folder Include="Resources\mipmap-xxxhdpi\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Android.Support.v4">
<Version>27.0.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NmeaParser\NmeaParser.csproj">
<Project>{1adc3666-1ddb-48c4-9811-1e58b6d09a7c}</Project>
<Name>NmeaParser</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\icon.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- 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>
-->
</Project>