diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2580491..ebbf6f2 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -43,6 +43,7 @@
+
\ No newline at end of file
diff --git a/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java b/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java
index 0ee95fc..aeb097e 100644
--- a/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java
+++ b/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java
@@ -71,6 +71,8 @@ public class MedicamentListActivity extends AppCompatActivity {
toolbar.setTitle(getTitle());
}
+ startService(new Intent(this, TimeService.class));
+
/*FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
diff --git a/app/src/main/java/net/foucry/pilldroid/TimeService.java b/app/src/main/java/net/foucry/pilldroid/TimeService.java
new file mode 100644
index 0000000..45551ee
--- /dev/null
+++ b/app/src/main/java/net/foucry/pilldroid/TimeService.java
@@ -0,0 +1,56 @@
+package net.foucry.pilldroid;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.IBinder;
+import android.widget.Toast;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * Created by jacques on 22/08/16.
+ */
+public class TimeService extends Service {
+ public static final long NOTIFY_INTERVAL = 10 *1000;
+
+ private Handler mHandler = new Handler();
+ private Timer mTimer = null;
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public void onCreate() {
+ if(mTimer != null) {
+ mTimer.cancel();
+ } else {
+ mTimer = new Timer();
+ }
+
+ mTimer.scheduleAtFixedRate(new TimeDisplayTimerTask(),0, NOTIFY_INTERVAL);
+ }
+
+ class TimeDisplayTimerTask extends TimerTask {
+ @Override
+ public void run() {
+ mHandler.post(new Runnable() {
+
+ @Override
+ public void run() {
+ Toast.makeText(getApplicationContext(),getDateTime(), Toast.LENGTH_SHORT).show();
+ }
+ });
+ }
+
+ private String getDateTime() {
+ SimpleDateFormat sdf = new SimpleDateFormat("[yyyy/MM/dd - HH:mm:ss]");
+ return sdf.format(new Date());
+ }
+ }
+}