The Friend Finder - MapActivity using GPS - FULL SOURCE

Tutorials that use the MapActivity. Many using GPS functionality.

Postby Bruce.lntu » Tue Nov 04, 2008 3:56 am

wongstar.iac wrote:
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!


Hi, you can do something when the emulator is started, then look for the "contacts" app on the home page.
hope this can help
User avatar
Bruce.lntu
Developer
Developer
 
Posts: 37
Joined: Thu Jan 03, 2008 11:36 am

Top

Postby wongstar.iac » Tue Nov 04, 2008 4:46 am

Bruce.lntu wrote:
wongstar.iac wrote:
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!


Hi, you can do something when the emulator is started, then look for the "contacts" app on the home page.
hope this can help

thank you! I Can run , but the km is static not move!just like 13km .. do you know? thanks!
wongstar.iac
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Oct 23, 2008 1:17 am

Postby wongstar.iac » Tue Nov 04, 2008 4:58 am

Bruce.lntu wrote:
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.031 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.


geo:37.402346,-122.075014# (Google-Headquarters, SF, California)
geo:37.444608,-122.216034# (McDonalds, near MountainView, SF, California)
geo:37.41622,-122.089919# (Starbucks, somewhere in SF, California)
or get your own on GoogleMaps (Hover the "Link to this Page"-Link)

put the code in you contacts in the nodes
wongstar.iac
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Oct 23, 2008 1:17 am

Manually give My GPS Location

Postby kSara » Thu Nov 06, 2008 7:24 pm

Hi :)

I manually gave my GPS location using this code

this.myLocation = new Location("gps");
this.myLocation.setLongitude( 46.51119 );
this.myLocation.setLatitude(-121.45356);

in the FriendFinder, updateList() method and FriendFinderMap updateView() methods

instead of "this.myLocation = myLocationManager.getLastKnownLocation("gps");". I comment it.

But I can't get the correct result, Map indicate me in another location near Africa. And also it dosen't center
the map according to my location. When I zoom In it doesn't zoom according to my location.

I tried this also "geo fix -121.45356 46.51119 4392 " but didn't work.

Somebody please help me to slove this problem, I'm new to Android :)

If there any updated code please kind enough to reply!

Thanks!
Attachments
Map.JPG
Location indicate error!
Map.JPG (14.96 KiB) Viewed 7319 times
Zoom.JPG
zoom error!
Always Zoom in to Tulsa.
Zoom.JPG (54.35 KiB) Viewed 7319 times
kSara
Freshman
Freshman
 
Posts: 2
Joined: Thu Nov 06, 2008 5:32 am

Postby jmasson » Fri Nov 14, 2008 3:30 am

Hi,

Firstly thanks to both plusminus and Marchu for this, great stuff.

I'm starting work on my own map based app, and was having a problem with not being able to 'pan' the map... So I found this and installed it, and seem to have the same issue... I can zoom in and out on my location ok, but I can't pan the map up/down/left/right.

Is there a certain set of keys on the keyboard you need to use or something? On the emulator the normal 'maps' application i can just pan around by clicking and dragging the mouse, but no app I've tested (my own, this and one other) have let me do this...

Thanks again for the app, and any tips.

JM
jmasson
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Nov 14, 2008 3:13 am
Location: Australia

Postby papaya » Tue Nov 25, 2008 3:10 am

Hi Marchu,

I downloaded the codes and it worked, but when i move another place

the gps still display old place.

why?
papaya
Freshman
Freshman
 
Posts: 8
Joined: Wed Oct 08, 2008 10:15 am

Top

Pan the map

Postby kSara » Wed Nov 26, 2008 3:43 pm

jmasson wrote:Hi,

Firstly thanks to both plusminus and Marchu for this, great stuff.

I'm starting work on my own map based app, and was having a problem with not being able to 'pan' the map... So I found this and installed it, and seem to have the same issue... I can zoom in and out on my location ok, but I can't pan the map up/down/left/right.

Is there a certain set of keys on the keyboard you need to use or something? On the emulator the normal 'maps' application i can just pan around by clicking and dragging the mouse, but no app I've tested (my own, this and one other) have let me do this...

Thanks again for the app, and any tips.

JM


this.myMapView = new MapView(this, "key");

:arrow: this.myMapView.setClickable(true);

try this to pan the map. :)
thanx!
kSara
Freshman
Freshman
 
Posts: 2
Joined: Thu Nov 06, 2008 5:32 am

Postby vishna » Fri Nov 28, 2008 11:24 am

Very nice example app, just one remark, in FriendFinder.java you do the following:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         /**
  3.  
  4.          * Make sure to stop the animation when we're no longer on screen,
  5.  
  6.          * failing to do so will cause a lot of unnecessary cpu-usage!
  7.  
  8.          */
  9.  
  10.         @Override
  11.  
  12.         public void onSaveInstanceState(Bundle icicle) {
  13.  
  14.                 this.doUpdates = false;
  15.  
  16.                 this.unregisterReceiver(this.myIntentReceiver);
  17.  
  18.                 super.onSaveInstanceState(icicle);
  19.  
  20.         }
  21.  
  22.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


According to documentation, BroadcastReceiver should be unregistered in Activity.onPause()

If registering a receiver in your Activity.onResume() implementation, you should unregister it in Activity.onPause(). (You won't receive intents when paused, and this will cut down on unnecessary system overhead). Do not unregister in Activity.onSaveInstanceState(), because this won't be called if the user moves back in the history stack.
vishna
Junior Developer
Junior Developer
 
Posts: 10
Joined: Tue Sep 16, 2008 1:37 pm

Postby vishna » Fri Nov 28, 2008 12:08 pm

Moreover android.intent.action.LOCATION_CHANGED seems to be removed in SDK 1.0, as there is no note about it in here. I think using LocationManager & LocationListener is sufficient, therefore I assume it's safe to remove MyIntentReceiver class and all its references.
vishna
Junior Developer
Junior Developer
 
Posts: 10
Joined: Tue Sep 16, 2008 1:37 pm

Postby sitara » Fri Dec 05, 2008 5:38 am

Hello everyone,


i am facing some errors in the friendfiner.java and friendfindermap.java


its seem this particular import cannot be resolved. can someone tell me what is the mistake?


import android.content.IntentReceiver;


sitara
sitara
Junior Developer
Junior Developer
 
Posts: 13
Joined: Thu Nov 27, 2008 8:27 am

Postby jorg » Sat Dec 13, 2008 11:23 am

IntentReceiver was removed -> you can use BroadcastReceiver
jorg
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Dec 13, 2008 11:20 am

Need help in running FriendFinder code under emulator

Postby yinglcs » Sun Dec 14, 2008 7:48 am

Hi,

I have download the FriendFinder code and run under android emulator (android sdk 1.0 r2).

The code compiles, but when i debug it within eclipse, i got a blank screen.

Here is what I see in the console:

[2008-12-14 00:40:18 - FriendFinder] ------------------------------
[2008-12-14 00:40:18 - FriendFinder] Android Launch!
[2008-12-14 00:40:18 - FriendFinder] adb is running normally.
[2008-12-14 00:40:18 - FriendFinder] Launching: org.anddev.android.friendfinder.FriendFinder
[2008-12-14 00:40:18 - FriendFinder] Automatic Target Mode: launching new emulator.
[2008-12-14 00:40:18 - FriendFinder] Launching a new emulator.
[2008-12-14 00:40:18 - Emulator] emulator: warning: opening audio output failed
[2008-12-14 00:40:18 - Emulator]
[2008-12-14 00:40:18 - FriendFinder] New emulator found: emulator-5554
[2008-12-14 00:40:18 - FriendFinder] Waiting for HOME ('android.process.acore') to be launched...
[2008-12-14 00:40:42 - FriendFinder] HOME is up on device 'emulator-5554'
[2008-12-14 00:40:42 - FriendFinder] Uploading FriendFinder.apk onto device 'emulator-5554'
[2008-12-14 00:40:43 - FriendFinder] Installing FriendFinder.apk...
[2008-12-14 00:40:53 - FriendFinder] Application already exists. Attempting to re-install instead...
[2008-12-14 00:40:57 - FriendFinder] Success!
[2008-12-14 00:40:58 - FriendFinder] Starting activity org.anddev.android.friendfinder.FriendFinder on device
[2008-12-14 00:41:01 - FriendFinder] ActivityManager: Starting: Intent { comp={org.anddev.android.friendfinder/org.anddev.android.friendfinder.FriendFinder} }
[2008-12-14 00:41:02 - FriendFinder] Attempting to connect debugger to 'org.anddev.android.friendfinder' on port 8608


Can you please tell me what am I missing?

Thank you.
yinglcs
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Nov 14, 2008 6:19 am

Postby sitara » Mon Dec 15, 2008 6:25 am

hi,
i have downloaded the FriendFinder version m3 and it has no errors and seems to have compiled successfully..
but the output is unlike those of the other members as posted above...
instead mine looks like

first this

Image


Image



Image

...what could be the problem?


Sitara
sitara
Junior Developer
Junior Developer
 
Posts: 13
Joined: Thu Nov 27, 2008 8:27 am

Postby yorgosg » Thu Dec 18, 2008 2:51 am

Hi

I have downloaded version 1.0 of the friendfinder. I had some trouble with the location getting null value at first, but then I replaced the code, with the code kSara suggested (only this worked, I tried everything else and nothing happenned):

//boolean gpsEnabled = myLocationManager.isProviderEnabled("gps");
//this.myLocation.setProvider("gps");

this.myLocation = new Location("gps");
this.myLocation.setLongitude( 46.51119 );
this.myLocation.setLatitude(-121.45356);

now the contacts I have, along with the distances appear normally.
However, when I press the menu button and then the "open visual friendtracker". the following error occurs:

Any ideas?? any help will be appreciated!
Attachments
error.jpg
error.jpg (18.5 KiB) Viewed 6572 times
yorgosg
Developer
Developer
 
Posts: 35
Joined: Wed Jan 30, 2008 9:53 am

Postby avolovoy » Thu Dec 18, 2008 6:23 am

sitara wrote:hi,
i have downloaded the FriendFinder version m3 and it has no errors and seems to have compiled successfully..
but the output is unlike those of the other members as posted above...
instead mine looks like

...what could be the problem?


Sitara

for first screen shot - you don't have Map API key it seems.
for last two - dude add some contacts :)
Alexey Volovoy
Bytesharp.NET
User avatar
avolovoy
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Nov 03, 2008 10:32 pm
Location: kansas

Top
PreviousNext

Return to Map Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests