Skip to content

Instantly share code, notes, and snippets.

@jonpryor
Created April 15, 2014 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonpryor/fc2292ae0094724e1d2b to your computer and use it in GitHub Desktop.
Save jonpryor/fc2292ae0094724e1d2b to your computer and use it in GitHub Desktop.
diff --git a/ServiceExample/Activity1.cs b/ServiceExample/Activity1.cs
index ce383b9..933e217 100644
--- a/ServiceExample/Activity1.cs
+++ b/ServiceExample/Activity1.cs
@@ -17,6 +17,7 @@ namespace ServiceExample
protected override void OnCreate(Bundle bundle)
{
+ Console.WriteLine ("# Activity1.OnCreate: at: {0}", DateTime.Now.ToString ());
base.OnCreate(bundle);
// Set our view from the "main" layout resource
@@ -31,6 +32,7 @@ namespace ServiceExample
protected override void OnStart()
{
+ Console.WriteLine ("# Activity.OnStart: at: {0}", DateTime.Now.ToString ());
base.OnStart();
_serviceConnection = new ServiceConnection();
var intent = new Intent();
diff --git a/ServiceExample/Properties/AndroidManifest.xml b/ServiceExample/Properties/AndroidManifest.xml
index 819e091..277a0fd 100644
--- a/ServiceExample/Properties/AndroidManifest.xml
+++ b/ServiceExample/Properties/AndroidManifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.droid" android:installLocation="auto">
- <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="18" />
+ <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="18" />
<application android:icon="@drawable/Icon" android:label="Service test Xamarin">
<service android:name="serviceexample.TestService"
android:process=".com.test.service"
diff --git a/ServiceExample/ServiceBinder.cs b/ServiceExample/ServiceBinder.cs
index 42b8428..e108c41 100644
--- a/ServiceExample/ServiceBinder.cs
+++ b/ServiceExample/ServiceBinder.cs
@@ -9,12 +9,14 @@ namespace ServiceExample
public ServiceBinder(TestService service)
{
+ Console.WriteLine ("# ServiceBinder..ctor: at: {0}", DateTime.Now.ToString ());
_reference = new WeakReference<TestService>(service);
}
public override void Test()
{
+ Console.WriteLine ("# ServiceBinder.Test: at: {0}", DateTime.Now.ToString ());
}
diff --git a/ServiceExample/ServiceConnection.cs b/ServiceExample/ServiceConnection.cs
index d9ac27d..1b69feb 100644
--- a/ServiceExample/ServiceConnection.cs
+++ b/ServiceExample/ServiceConnection.cs
@@ -15,11 +15,13 @@ namespace ServiceExample
public void OnServiceConnected(ComponentName name, IBinder service)
{
+ Console.WriteLine ("# ServiceConnection.OnServiceConnected: at: {0}", DateTime.Now.ToString ());
Service = (ITest)ITestStub.AsInterface(service);
}
public void OnServiceDisconnected(ComponentName name)
{
+ Console.WriteLine ("# ServiceConnection.OnServiceDisconnected: at: {0}", DateTime.Now.ToString ());
Service = null;
}
diff --git a/ServiceExample/TestService.cs b/ServiceExample/TestService.cs
index 3aa5566..9b3abcb 100644
--- a/ServiceExample/TestService.cs
+++ b/ServiceExample/TestService.cs
@@ -1,4 +1,5 @@
-using Android.App;
+using System;
+using Android.App;
using Android.Content;
using Android.OS;
@@ -9,8 +10,14 @@ namespace ServiceExample
{
#region Overrides
+ public TestService ()
+ {
+ Console.WriteLine ("# TestService..ctor: Constructed At: {0}", DateTime.Now.ToString ());
+ }
+
public override IBinder OnBind(Intent intent)
{
+ Console.WriteLine ("# TestService.OnBind: at: {0}", DateTime.Now.ToString ());
var binder = new ServiceBinder(this);
return binder;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment