diff --git a/app/app.iml b/app/app.iml
index 195d778..7cd5b07 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -83,6 +83,8 @@
+
+
diff --git a/app/build.gradle b/app/build.gradle
index edf4fd2..8867c9e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -23,4 +23,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile "com.android.support:support-v4:21.0.+"
}
diff --git a/app/src/main/java/xdsopl/robot36/MainActivity.java b/app/src/main/java/xdsopl/robot36/MainActivity.java
index ea40f85..cd0209c 100644
--- a/app/src/main/java/xdsopl/robot36/MainActivity.java
+++ b/app/src/main/java/xdsopl/robot36/MainActivity.java
@@ -18,11 +18,15 @@ limitations under the License.
package xdsopl.robot36;
import android.app.Activity;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
+import android.support.v4.app.NotificationCompat;
import android.view.Menu;
import android.view.MenuItem;
import java.io.File;
@@ -34,6 +38,19 @@ import java.util.Date;
public class MainActivity extends Activity {
private ImageView view;
private Bitmap bitmap;
+ private NotificationManager manager;
+ private int notifyID = 1;
+
+ private void showNotification() {
+ Intent intent = new Intent(this, MainActivity.class);
+ PendingIntent pending = PendingIntent.getActivity(this, 0, intent, 0);
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
+ .setSmallIcon(R.drawable.ic_launcher)
+ .setContentTitle(getString(R.string.app_name))
+ .setContentText(getString(R.string.decoder_running))
+ .setContentIntent(pending);
+ manager.notify(notifyID, builder.build());
+ }
void updateTitle(final String newTitle)
{
@@ -83,23 +100,27 @@ public class MainActivity extends Activity {
setContentView(R.layout.activity_main);
view = (ImageView)findViewById(R.id.image);
view.activity = this;
+ manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
}
@Override
protected void onDestroy () {
view.destroy();
+ manager.cancel(notifyID);
super.onDestroy();
}
@Override
protected void onPause() {
view.pause();
+ showNotification();
super.onPause();
}
@Override
protected void onResume() {
view.resume();
+ manager.cancel(notifyID);
super.onResume();
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 14dcf4d..4e26d77 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -2,6 +2,7 @@
Robot36
+ "decoder is running
Debug Sync
Debug Image
Debug Image and Sync