Location service sample not found

2302
6
01-13-2012 05:00 AM
MarcosSilva
New Contributor
Hi, everybody.

I have just installed ArcGIS for Android API plugin on my Eclipse environment and everything seems to work fine. I have looked for the location service sample, though, and it is not available. Can anyone tell me where I can download this sample? Thanks in advance.

Artur
0 Kudos
6 Replies
KyleShimabukuro
New Contributor III
You can try the sample app called Nearby that is included with the SDK. I've also included a code snippet that you can add to an Options Menu button (or on-screen button, etc.):

LocationService ls = map.getLocationService();
if (ls.isStarted() == false) {
ls.setAutoPan(false);
ls.start();
Point point = ls.getPoint();
map.zoomToScale(point, 60000);
Toast.makeText(YourActivityName.this, "Select My Location again to disable GPS",Toast.LENGTH_SHORT).show();
}
else {       
ls.stop();       
};
0 Kudos
MarcosSilva
New Contributor
Hi, Kshimabukuro. Thanks for your answer. I didn't find the Nearby sample after installing the SDK at Eclipse's "Install New Software" tool, but I've downloaded the SDK from  the link below. It has a folder named /plugins where I found the file com.esri.arcgis.android.samples_1.0.1.201112131338.jar. This file contains all the samples, including Nearby. For some reason, at this time, the online installation for Eclipse doesn't bring all the plugins. Best regards!

http://resources.arcgis.com/content/arcgis-android/sdk
0 Kudos
KyleShimabukuro
New Contributor III
In Eclipse, you can also try File > New > Other > ArcGIS for Android > ArcGIS Samples for Android > Next. In the following window, you should see all of the sample apps.
0 Kudos
JasonHine
Esri Contributor
At ArcGIS Runtime SDK for Android version 10.2, Eclipse will only show samples that target API versions you have installed.  To see the samples, make sure you have installed Android API versions 10 and 15 using Window > Android SDK Manager.
0 Kudos
ErwinSoekianto
Esri Regular Contributor
I agree with Jason, this "Nearby" sample requires API level 10 installed specifically.
0 Kudos
DanO_Neill
Occasional Contributor III
The latest version of the Android SDK only shows samples for the Android platform API's you have installed as has been mentioned in this thread.  The reason for this is to avoid the errors associated with adding a sample based on a platform API that the developer does not have installed.  While the latest versions of all the samples are found online through the Eclipse New Sample wizard, all samples available at release time are also included on disk when you download the sdk zip file located here.  Open up the downloaded zip file and navigate to the samples directory.  You will find the Nearby sample under the 'Display-Information' folder.  Of course you will still need the appropriate Android platform API installed to use it as is or refactor the sample to a Platform API you have installed.
0 Kudos