Skip to content

Commit

Permalink
Updates from the meeting
Browse files Browse the repository at this point in the history
  • Loading branch information
Foovanadil committed Jul 24, 2014
1 parent ebd0d20 commit 206c1f5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
12 changes: 12 additions & 0 deletions TIG.Todo/TIG.Todo.Android/GeofenceIntentService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using Android.App;
using Android.Content;
using Android.Support.V4.App;
using Android.Gms.Location;
using Android.Locations;


namespace TIG.Todo.AndroidApp
{
Expand All @@ -10,6 +14,14 @@ public class GeofenceIntentService : IntentService

protected override void OnHandleIntent (Intent intent)
{
bool isEntering= intent.GetBooleanExtra(LocationManager.KeyProximityEntering, false);
NotificationCompat.Builder builder = new NotificationCompat.Builder (this);
var notification = builder
.SetContentTitle("TODO")
.SetContentText((isEntering? "Entering" : "Exiting") + " fence")
.Build();
var notificationService = (NotificationManager)GetSystemService (Context.NotificationService);
notificationService.Notify (1, notification);
int i = 17;
//TODO: check LocationManager.KEY_PROXIMITY
}
Expand Down
10 changes: 7 additions & 3 deletions TIG.Todo/TIG.Todo.Android/GeofencingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
namespace TIG.Todo.AndroidApp
{
[Service]
[IntentFilter(new[] { CustomActions.TODO_START_LOCATION_MONITORING, CustomActions.TODO_SET_GEOFENCE })]
[IntentFilter(new[] {
CustomActions.TODO_START_LOCATION_MONITORING,
CustomActions.TODO_SET_GEOFENCE })]
public class GeofencingHelper : Service, Android.Locations.ILocationListener
//, IGooglePlayServicesClientConnectionCallbacks
//, IGooglePlayServicesClientOnConnectionFailedListener
Expand Down Expand Up @@ -100,8 +102,10 @@ public void SetFence()
if (!isWithinRadius)
{
var intent = new Intent(CustomActions.TODO_WITHIN_PROXIMITY);
PendingIntent pendingIntent = PendingIntent.GetService(this, 0, intent, PendingIntentFlags.UpdateCurrent);
_locationManager.AddProximityAlert(currentLatitude, currentLongitude, radiusInMeters, -1, pendingIntent);
PendingIntent pendingIntent = PendingIntent.GetService(this, 0, intent,
PendingIntentFlags.UpdateCurrent);
_locationManager.AddProximityAlert(currentLatitude, currentLongitude,
radiusInMeters, -1, pendingIntent);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions TIG.Todo/TIG.Todo.Android/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ protected override void OnCreate (Bundle bundle)
var taskListAdapter = new TaskListAdapter (this, taskManager);
taskListView.Adapter = taskListAdapter;

//Intent intent = new Intent (this, typeof(GeofencingHelper));
StartService(new Intent(CustomActions.TODO_START_LOCATION_MONITORING));
}

Expand Down
2 changes: 2 additions & 0 deletions TIG.Todo/TIG.Todo.Android/TIG.Todo.AndroidApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Adapter\TaskListAdapter.cs" />
<Compile Include="GeofencingHelper.cs" />
<Compile Include="CustomActions.cs" />
<Compile Include="GeofenceIntentService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
Expand Down

0 comments on commit 206c1f5

Please sign in to comment.