Add:android:Added navit notification icon
authorrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 17 Mar 2011 11:53:40 +0000 (11:53 +0000)
committerrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 17 Mar 2011 11:53:40 +0000 (11:53 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4355 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/android/src/org/navitproject/navit/Navit.java

index 415f2a9..466e7c0 100644 (file)
@@ -33,6 +33,9 @@ import org.navitproject.navit.NavitMapDownloader.ProgressThread;
 import android.app.Activity;\r
 import android.app.AlertDialog;\r
 import android.app.Dialog;\r
+import android.app.Notification;\r
+import android.app.NotificationManager;\r
+import android.app.PendingIntent;\r
 import android.app.ProgressDialog;\r
 import android.content.Context;\r
 import android.content.DialogInterface;\r
@@ -231,7 +234,15 @@ public class Navit extends Activity implements Handler.Callback
 \r
                // init translated text\r
                NavitTextTranslations.init();\r
-\r
+               \r
+               // Setup a notification in the android notification bar, remove it in the exit() function\r
+               NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\r
+               Notification notification = new Notification(R.drawable.icon,"Navit is running",0);\r
+               notification.flags = Notification.FLAG_NO_CLEAR;\r
+               PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);\r
+               notification.setLatestEventInfo(getApplicationContext(), "Navit running", "Navit still running", appIntent);\r
+               nm.notify(R.string.app_name, notification);\r
+               \r
                // get the local language -------------\r
                Locale locale = java.util.Locale.getDefault();\r
                String lang = locale.getLanguage();\r