Opened 9 years ago

Closed 4 years ago

#737 closed defect/bug (fixed)

Android: Does not restore saved coordinates from the center.txt at startup.

Reported by: sav Owned by: KaZeR
Priority: minor Milestone: version 0.5.1
Component: core Version: git master
Severity: normal Keywords: android, gps
Cc:

Description

Problem exist in the function bookmarks_set_center_from_file file navit/bookmarks.c due to a lack of getline in Android. Solution for example may be:

--- navit/bookmarks.c.orig	2010-11-07 12:02:38.000000000 +0300
+++ navit/bookmarks.c	2011-01-13 19:35:06.479158999 +0300
@@ -380,9 +380,11 @@
 void
 bookmarks_set_center_from_file(struct bookmarks *this_, char *file)
 {
-#ifndef HAVE_API_ANDROID
 	FILE *f;
 	char *line = NULL;
+#ifdef HAVE_API_ANDROID
+	char str[100];
+#endif
 
 	size_t line_size = 0;
 	enum projection pro;
@@ -391,7 +393,13 @@
 	f = fopen(file, "r");
 	if (! f)
 		return;
+#ifdef HAVE_API_ANDROID
+	fgets(str, 1024, f);
+	line = g_malloc(strlen(str));
+	strcpy(line,str);
+#else
 	getline(&line, &line_size, f);
+#endif
 	fclose(f);
 	if (line) {
 		center = transform_center(this_->trans);
@@ -400,7 +408,6 @@
 		free(line);
 	}
 	return;
-#endif
 }
 
 void

Change History (4)

comment:1 Changed 9 years ago by korrosa

  • Summary changed from Android: Do not restore saved coordinates from the center.txt at startup. to Android: Does not restore saved coordinates from the center.txt at startup.

comment:2 Changed 9 years ago by aaaapublic

I'm having the same problem. With GPS off, Navit is starting up in locations that is NOT the last known location (presumably stored in center.txt), but at a location that was in my history of places several days ago.

I'm using Navit 0.5.0.4666 from SVN, on Samsung Galaxy S Gingerbread 2.3.4.

comment:3 Changed 7 years ago by usul

  • Keywords android gps added
  • Milestone set to version 0.5.1

Is this still an issue?

comment:4 Changed 4 years ago by kazer

  • Resolution set to fixed
  • Severity set to normal
  • Status changed from new to closed

I just tried and cannot reproduce it :

  • with a gps fix, exit navit
  • disable location service
  • restart navit. View is centered on the last location.
  • move to another location (i used the search, then "view on map")
  • restart navit. View is centered on the last location from the search.

Looks like this issue is resolved. Please reopen if needed.

Note: See TracTickets for help on using tickets.