The Friend Finder - MapActivity using GPS - FULL SOURCE

Tutorials that use the MapActivity. Many using GPS functionality.

Source for 1.0 SDK

Postby Marchu » Sun Sep 28, 2008 7:43 pm

After some hard strugling with the code, i managed to get it work with the 1.0 SDK.
There are so many changes with the 1.0 SDK, and so less demo's and examples, that the most work was trial and error . (for almost 24 hours)
I just started with figuring out Android, so it was a nice learning curve :)

There are many changes in the code but not in the main performance, and i have left (offcourse) the comments from plusminus in place.
This to give a idea what the code is doing.

The most changes are syntax changes, eq. zoomTo is now setZoom, menu.Item is now MenuItem, etc. (to give a idea)

Also changes to calculate the pixels on screen, from a Geopoint is totaly changed.
In the old demo they use CalculatePixels, what was a special thing for this. Now this is done by:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. mapView.getProjection().toPixels(point,myScreenCoords);
  3.  
  4.  
Parsed in 0.029 seconds, using GeSHi 1.0.8.4


Youre own location will now also be always in the center if you zoom in and out.

There's are more new things with 1.0, but i think the most is clear after seeing the code.

p.s. Don't forget for the first time, to set youre location thruw geo fix (telnet)
For the new ones on how to do that.
- Open a console
- type: telnet localhost 5554
(this connects to the simulator on port 5554, to simulate things)
- type: geo fix -121.45356 46.51119 4392
(or any other location with a longitude latitude height)

tip to get your own geo location:
http://www.mygeoposition.com/

Thats it, happy programming :P

Cheers
Attachments
FriendFinder_v10SDK.rar
Remake code for 1.0 SDK
(65.31 KiB) Downloaded 2318 times
Last edited by Marchu on Mon Oct 20, 2008 12:10 am, edited 1 time in total.
Marchu
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sat Sep 27, 2008 4:11 pm
Location: Netherlands

Top

Postby ninor » Sun Sep 28, 2008 8:58 pm

Good job, Marchu!
Thank you very much for taking your time updating this example
User avatar
ninor
Moderator
Moderator
 
Posts: 180
Joined: Thu Aug 14, 2008 6:30 pm
Location: Barcelona, Spain

Postby plusminus » Mon Sep 29, 2008 2:00 am

Really nice Marchu. I've put link to your post to the beginning of this topic.

Best Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby William Wen » Sat Oct 11, 2008 5:24 pm

Really appreciate your job, Marchu!
And the following permissions have been removed in SDK1.0:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.ACCESS_GPS" />
  2.  
  3. <uses-permission android:name="android.permission.ACCESS_LOCATION"
  4.  
  5. <uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
  6.  
  7. <uses-permission android:name="android.permission.ACCESS_CELL_ID" />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
William Wen
William Wen
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Sep 23, 2008 4:28 pm

Re: Source for 1.0 SDK

Postby eviesun » Sat Oct 18, 2008 5:32 am

Hi, Machu,

I downloaded your code. but after i typed the FriendFinder icon on the main screen, it has the following run time exception. Seems it is rooted from the Android SDK.
The emulator says ".friendfinder has stopped unexpectedly...."


I am totally fresh to Android.. Can u help me to figure out what the problem is? thanks a lot.
Attachments
exception.jpg
exception.jpg (32.83 KiB) Viewed 15302 times
eviesun
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Oct 18, 2008 5:22 am

Postby Paranoid » Sun Oct 19, 2008 5:12 pm

I'm getting the same error :(
Paranoid
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sun Oct 19, 2008 5:10 pm

Top

Postby Bruce.lntu » Wed Oct 22, 2008 9:22 am

Hi Marchu,

I downloaded the codes and it worked, but only worked as below:

My question is: why can not find the menu of adding contacts? or any other fountions?

the whole running showed no error. this really confused me. pls tell us where the problems happend. thank you.

regards
Bruce
Attachments
3.jpg
my location is only displayed in the red ellipse.
3.jpg (64.3 KiB) Viewed 15147 times
2.jpg
when the map display, then press the MENU
2.jpg (22.92 KiB) Viewed 15147 times
1.jpg
when press the &quot;menu&quot;
1.jpg (9.93 KiB) Viewed 15147 times
User avatar
Bruce.lntu
Developer
Developer
 
Posts: 37
Joined: Thu Jan 03, 2008 11:36 am

Postby Bruce.lntu » Thu Oct 23, 2008 9:30 am

after adding contacts following the FriendFinder 1, still can not find the friend's location with only "Me"and round dot. somebody tell us why?
User avatar
Bruce.lntu
Developer
Developer
 
Posts: 37
Joined: Thu Jan 03, 2008 11:36 am

Postby Bruce.lntu » Thu Oct 23, 2008 12:26 pm

plusminus wrote:Hello venkat,

it is displaying the list of your friends but you seem to have forgotten to set the "geo"-URI.

You go to the actual Map using the Menu-Button on the emulator. It starts the Map-Activity that show you (and your contacts/friends if you properly set the geo-URI to their notes, as shown in the first Part of the Tutorial)
This is the code taklen from above, that opens the MapActivity:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override
  2.      public boolean onCreateOptionsMenu(Menu menu) {
  3.           boolean supRetVal = super.onCreateOptionsMenu(menu);
  4.           menu.add(0, 0, getString(R.string.main_menu_open_map));
  5.           return supRetVal;
  6.      }
  7.      @Override
  8.      public boolean onOptionsItemSelected(Menu.Item item) {
  9.           switch (item.getId()) {
  10.                case 0:
  11.                     startSubActivity(new Intent(this, FriendFinderMap.class), 0);
  12.                     return true;
  13.           }
  14.           return false;
  15.      }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


You will at least see yourself on the Map :!:

Please tell us if that fixed it :?:

Regards,
plusminus

Regards,
plusminus


I also got the same problem as the screem shot are below:
please plusminus tell us where is the real problem. thank you ,it really cost me so much time looking for the error.
Attachments
shot000.jpg
set the geo
shot000.jpg (19.5 KiB) Viewed 15102 times
shot002.jpg
not set km?
shot002.jpg (15.08 KiB) Viewed 15102 times
shot004.jpg
&quot;me&quot; is in the red circle
shot004.jpg (24.83 KiB) Viewed 15102 times
User avatar
Bruce.lntu
Developer
Developer
 
Posts: 37
Joined: Thu Jan 03, 2008 11:36 am

Re: The Friend Finder - MapActivity using GPS - FULL SOURCE

Postby wongstar.iac » Tue Oct 28, 2008 4:04 am

when I run sample ap about maps there is a error:

Does anyone understand the error "Couldn't get connection factory
client" ? I have the same error in my app.

Thanks for help.
wongstar.iac
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Oct 23, 2008 1:17 am

Re: The Friend Finder - MapActivity using GPS - FULL SOURCE

Postby java.padawan » Tue Oct 28, 2008 11:09 am

wongstar.iac wrote:when I run sample ap about maps there is a error:

Does anyone understand the error "Couldn't get connection factory
client" ? I have the same error in my app.

Thanks for help.


try this.
http://www.androidph.com/2008/10/androi ... iewer.html
java.padawan
Freshman
Freshman
 
Posts: 6
Joined: Mon Oct 27, 2008 7:07 pm

problem with override

Postby mschot » Wed Oct 29, 2008 9:56 pm

Hi Everyone,

Tried compiling the code but eclipse cant compile as there are errors it seems that the methods in the myLocationListener the cant override the LocationListener methods as eclipse giver the following error(s):

-The method onProviderDisabled(String) of type FriendFinder.myLocationListener must override a superclass method
- implements android.location.LocationListener.onProviderDisabled

I'm kind of a newbie at android and would appreciate any help.

thanks in advance.

mschot
mschot
Freshman
Freshman
 
Posts: 3
Joined: Wed Oct 29, 2008 9:47 pm

Re: The Friend Finder - MapActivity using GPS - FULL SOURCE

Postby mschot » Sun Nov 02, 2008 6:03 pm

managed to compile it now by commenting the overrides...

wongstar.iac wrote:when I run sample ap about maps there is a error:

Does anyone understand the error "Couldn't get connection factory
client" ? I have the same error in my app.

Thanks for help.


go to line 214 in FriendFinderMap.java and replace "key?" with your api key in:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. this.myMapView = new MapView(this, "key?");
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
mschot
Freshman
Freshman
 
Posts: 3
Joined: Wed Oct 29, 2008 9:47 pm

Postby wongstar.iac » Mon Nov 03, 2008 10:20 am

Bruce.lntu wrote:Hi Marchu,

I downloaded the codes and it worked, but only worked as below:

My question is: why can not find the menu of adding contacts? or any other fountions?

the whole running showed no error. this really confused me. pls tell us where the problems happend. thank you.

regards
Bruce

hi, I have the same picture with you ? what's wrong?
I also havn't the menu of adding contacts! help me !
thank you!
wongstar.iac
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Oct 23, 2008 1:17 am

Re: The Friend Finder - MapActivity using GPS - FULL SOURCE

Postby wongstar.iac » Mon Nov 03, 2008 10:23 am

mschot wrote:managed to compile it now by commenting the overrides...

wongstar.iac wrote:when I run sample ap about maps there is a error:

Does anyone understand the error "Couldn't get connection factory
client" ? I have the same error in my app.

Thanks for help.


go to line 214 in FriendFinderMap.java and replace "key?" with your api key in:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. this.myMapView = new MapView(this, "key?");
Parsed in 0.036 seconds, using GeSHi 1.0.8.4

thank you ,the error is my apikey is wrong! thank you now I can run ! but there are also have some question!
first , I havn't a menu contact
wongstar.iac
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Oct 23, 2008 1:17 am

Top
PreviousNext

Return to Map Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest