How do i save current coordinates and use them later?

edited May 2015 in Android Mode

Hi! I am very new to Processing and it's my first time making an app for android. I want to make an app which saves the coordinates of your current position via a button press using GPS (i have done the GPS part), then you walk somewhere else and press another button which saves those current position and opens the google maps app and applies the cooridinates from and to so you can navigate to your initial position.

My problem is i don't know how to save the current coorinates using a button and then, when you have moved, pressing another button which will open google maps and insert the cooridinates. I have made an app using AppInventor where the source looks like this: http://prntscr.com/6zwni3 although it's another thing programming it by hand. I appriciate any attemt to help me, thank you!

Answers

  • Which part of this is giving you trouble? Storing coordinates in a variable? Detecting button presses? Opening google maps? Something else? Try to break your problem down into much smaller pieces, then tackle each small piece one at a time.

  • edited April 2015

    Fist of storing cooridinates and use them later. I'm guessing i have to use some sort of database? Second is opening google maps Third is putting the cooridinates into google maps

  • Okay, so first: storing coordinates. How are you getting the coordinates? What type are they?

    By that I mean, I can get the mouseX and mouseY position of the mouse. Their type is float. I can store them in a float variable like this:

    float rememberedMouseX = mouseX;

    You'd probably end up doing something similar with your coordinates.

  • Okay, i am using the KetaiLocation libary to get my long. lat and altitude. And their type is double. I have reached the point where i want to hardcode some "to" cooridinates ( i can do that), and then make an if buttonpressed, which take the current cooridinates and puts them together with the "to" location in a link to google maps which then opens with those two "to" and "from" (the two cooridinates). Any help is greatly appreciated

  • How do i open google maps when i press a button?

  • You can store and retrive data on a device, with the help of sqLight for example, but using database is not needed. You can use a CSV file for example to temporary store coordinates. It is easy to use in processing because of existance of Table class.

  • For google maps, you probabbly need to visit their API page and search for oppenning application and parsing your values. https://developers.google.com/maps/documentation/android/

  • Ok thanks. How about calling a phone number via a button press?

  • @Henji:: as for temporary store coordinates: sharedPreferences do that in android. as for storing a big lot of coordinates you have to create a file on the phone (write external storage permission). as for maps with processing, unfolding lib is supposed to work in android mode and openstreet maps; i say i "supposed" because i have got a lot of problems with unfolding...And decided to leave processing for eclipse and android native coding: then you can use google maps...

  • Yeah, this whole thing doesn't really sound like a job for Processing. You'd probably have an easier time in "pure" Android.

Sign In or Register to comment.