|
POST
|
Tom, Sorry for the delayed response. I've seen this happen in instances where there were multiple LocationService/LocationManager instances created. LocationManager can only have a single instance running or you won't be able to shut it off and hence turn it back on. Here's a link to the EsriQuickStart which shows an advanced way of managing, starting and stopping location services: https://github.com/Esri/quickstart-map-android/blob/master/EsriQuickStart/src/com/esri/quickstart/EsriQuickStart.java. Look at stopLocationService() starting at line 656, and delayedStartLocationService() starting at line 753. I've also built an Android GPS Tool where you can test various scenarios, especially if you are having issues and need to compare/contrast settings: https://github.com/Esri/android-gps-test-tool -Andy
... View more
06-25-2013
06:42 AM
|
0
|
0
|
671
|
|
POST
|
Hi, I have a few pointers that will hopefully shed some light on your comments and concerns. >>Is there a particular reason the android API was designed this way?. Why didnt ESRI make use of listeners/callbacks to handle the results from network operations. Please note, this is a native Android Operating System programming pattern that is adopted from its Java-based roots. Our API team tries their best to promote best practices for the Android/Java development environment. We take similar approaches for the other APIs you mentioned. For example, you'll see a different pattern for the iOS developer environment. >>Which is the better method to implement routing task? AsyncTask, Handlers and Threads all have their pluses and minuses and they are also related. The AsyncTask pattern is considered to be the easiest way to learn implementing multi-threading and to properly resynchronize results back to the main user interface thread. Since Android is multi-threaded it is recommended to understand all three of these approaches when building applications. There are some excellent discussions on StackOverflow for example: http://stackoverflow.com/questions/6964011/handler-vs-asynctask-vs-thread. For reference, here is an Android Best Practices article on Processes and Threads. These concepts, patterns and practices may seem a bit foreign at first if you've been using other programming languages. I hope these links help get you pointed in the right direction. -Andy
... View more
06-07-2013
03:21 PM
|
0
|
0
|
1391
|
|
POST
|
Alex, Thanks to @SathyaPrasad the workaround at this point in time is to force Phonegap/Cordova to use HTTP. Add the following for web maps: esri.arcgis.utils.arcgisUrl = esri.arcgis.utils.arcgisUrl.replace("file:", "http:"); And, if you are using the locator (geocoder) widget: widget._arcgisGeocoder.url = widget._arcgisGeocoder.url.replace("file:", "http:") Here's a psuedo-code example using the new AMD pattern: require(["esri/map","esri/arcgis/utils","esri/dijit/Legend","esri/dijit/Scalebar"],
function(Map,utils,Legend,Scalebar) {
var map = null;
utils.arcgisUrl = utils.arcgisUrl.replace("file:", "http:");
var mapDeferred = utils.createMap("4778fee6371d4e83a22786029f30c7e1", "mapDiv");
mapDeferred.then(function(response) {
dojo.byId("title").innerHTML = response.itemInfo.item.title;
dojo.byId("subtitle").innerHTML = response.itemInfo.item.snippet;
map = response.map;
...
...
...
}
... View more
05-29-2013
12:54 PM
|
0
|
0
|
629
|
|
POST
|
Fraser, I don't believe there is a property to adjust that in the current version of the LocationService. You'll probably need to switch to the Android LocationManager if you want to fine tune GPS settings. Here's a tool and some articles that explore how to use LocationManager, if that's the direction you want to go: https://github.com/Esri/android-gps-test-tool
... View more
05-28-2013
03:04 PM
|
0
|
0
|
536
|
|
POST
|
Slightly modified the code above. I noticed that for some reason sometimes the PNG file isn't created properly and it has a size of 0 bytes. So I added a check that verifies the width of the PNG > 0.
private void createMapViewImage(){
final Runnable runnable = new Runnable() {
int counter = 0;
@Override
public void run() {
counter++;
try{
final Handler handler = new Handler();
//Use 0, 0 for x/y so that you capture the entire MapView
final Bitmap bitmap = mMapView.getDrawingMapCache(0, 0,
mMapView.getWidth(), mMapView.getHeight());
Log.d("TEST", "Map Width = " + mMapView.getWidth() + " Map Height = "
+ mMapView.getHeight());
Log.d("TEST","Testing if able to create mapView bitmap. Attempt #" + counter);
if(bitmap != null){
final File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
final File output = new File(dir, "mapview.png");
final String imagePath = output.getAbsolutePath();
FileOutputStream fileOut;
try{
fileOut = new FileOutputStream(output);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOut);
int w = bitmap.getWidth();
if(w > 0){
fileOut.flush();
fileOut.close();
bitmap.recycle();
handler.post(mUpdateResults);
Log.d("TEST","mapView bitmap has been successfully created.");
}
else if(counter < 5){
Log.d("TEST","PNG didn't create properly so trying again.");
handler.postDelayed(this, 1000);
}
else{
Log.d("TEST","Unable to create PNG.");
}
}catch(Exception e){
e.printStackTrace();
}
}
else if(counter < 5){
handler.postDelayed(this, 2000);
}
else{
Log.d("TEST","Unable to create mapView bitmap after 5 attempts.");
}
}
catch(Exception exc){
Log.d("TEST","Unable to create mapView exception: " + exc.toString());
}
}
};
runnable.run();
}
final Runnable mUpdateResults = new Runnable() {
@Override
public void run() {
doSomething();
}
};
private void doSomething(){
final File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM + "/mapview.png");
//TO-DO
}
... View more
02-03-2013
07:33 AM
|
0
|
2
|
1991
|
|
POST
|
It has a retry loop because you can get null values when calling getDrawingMapCache. I'm not exactly sure why, and it could very well be device dependent. I noticed it on both 2.3 and 4.x phones. The null value is typically the first try, and then on the second try after waiting a few seconds you should be able to get the cache. Just a note, in your psuedo-code below, the while loop itself looks like it runs on the UI thread which could cause laggy behavior of the map. You may have already done this in your code, so for other readers the recommended practice is to place while loops inside a Runnable(){public void run(){while...}}. Just a suggestion 🙂 -Andy Here's some references: Another forum post on getDrawingMapCache null values. Handling expensive operations on the UI thread.
... View more
02-01-2013
07:10 AM
|
0
|
0
|
1991
|
|
POST
|
Greg, Give this a try. It's some test code I wrote that shows how to create an image of the MapView and then store it locally on the device. Note, I've only tested this using the ArcGIS Runtime for Android SDK v10.1.1 and on a 4.0.x device. I'm not 100% certain it will run on a 2.x or 3.x device.
private void createMapViewImage(){
final Runnable runnable = new Runnable() {
int counter = 0;
@Override
public void run() {
counter++;
try{
final Handler handler = new Handler();
//Use 0, 0 for x/y so that you capture the entire MapView
final Bitmap bitmap = mMapView.getDrawingMapCache(0, 0,
mMapView.getWidth(), mMapView.getHeight());
Log.d("TEST", "Map Width = " + mMapView.getWidth() + " Map Height = "
+ mMapView.getHeight());
Log.d("TEST","Testing if able to create mapView bitmap. Attempt #" + counter);
if(bitmap != null){
Log.d("TEST","mapView bitmap has been successfully created.");
final File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
final File output = new File(dir, "mapview.png");
final String imagePath = output.getAbsolutePath();
FileOutputStream fileOut;
try{
fileOut = new FileOutputStream(output);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOut);
fileOut.flush();
fileOut.close();
bitmap.recycle();
}catch(Exception e){
e.printStackTrace();
}
handler.post(mUpdateResults);
}
else if(counter < 5){
handler.postDelayed(this, 2000);
}
else{
Log.d("TEST","Unable to create mapView bitmap after 5 attempts.");
}
}
catch(Exception exc){
Log.d("TEST","Unable to create mapView exception: " + exc.toString());
}
}
};
runnable.run();
}
final Runnable mUpdateResults = new Runnable() {
@Override
public void run() {
doSomething();
}
};
private void doSomething(){
final File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM + "/mapview.png");
//You are now back on the UI thread and have access to the image file .
}
... View more
01-31-2013
01:36 PM
|
0
|
0
|
1991
|
|
POST
|
I just saw this. I'm passing it back over to the support folks now for re-evaluation. Are you using the latest SDK version 10.1.1? -Andy
... View more
01-24-2013
09:52 AM
|
0
|
0
|
2982
|
|
POST
|
I agree that doesn't sound right. If there's no geometry I thought the featureSet would be treated as a Table. My recommendation is for you to open a support ticket to get the issue logged. As a temporary work-around maybe you can assign a mock geometry to the Graphic and then flag it with a boolean attribute that let's your code know it's using a mock geometry... -Andy
... View more
01-24-2013
09:45 AM
|
0
|
0
|
699
|
|
POST
|
Jessica, I don't have an exact answer to your first question, but maybe these links will get you pointed in the right direction: ArcGISLocalTiledLayer: http://resources.arcgis.com/en/help/android-sdk/api/reference/com/esri/android/map/ags/ArcGISLocalTiledLayer.html Offline WindTurbine Sample app: https://github.com/Esri/offline-windturbine-inspector-android -Andy
... View more
01-24-2013
08:32 AM
|
0
|
0
|
1111
|
|
POST
|
James, yes if you have an app that already is using a Location Listener you can use what are called "Mock" locations. There are a few steps to follow: 1) Add this line to your manifest permissions: <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"> 2) Make sure in your phone settings that you have checked "Allow mock locations" 3) Create and inject the mock locations: Location mockLocation = new Location(mocLocationProvider);
mockLocation.setLatitude(-34.000);
mockLocation.setLongitude(72.000);
mockLocation.setAltitude(2000);
mockLocation.setTime(1359043067);
locationManager.setTestProviderLocation( mocLocationProvider, mockLocation);
4) To simulate movement set up a handler.postDelayed(this,<delay in ms>) and loop through an array containing your mock locations.
... View more
01-24-2013
06:01 AM
|
0
|
0
|
685
|
|
POST
|
Tom, Not sure if this is exactly what you need, but attached is an ActionScript library that shows various methods for drawing a circle on the client using radius as an input property. -Andy
... View more
01-22-2013
09:21 AM
|
0
|
0
|
1261
|
|
POST
|
Eric, Flex mobile uses the Adobe Integrated Runtime (AIR) and that eliminates the need to have Flash Player on the mobile device. Yes, the code inside your mobile application can reuse code from a Flex web app. However, as you might guess mobile apps have different skinning needs, some components work better on mobile for performance reasons, and mobile apps are generally much smaller in file size than desktop Flex apps. Here are a few article, although slightly dated, that should help you get started: Mobile Development using Flex 4.5 SDK Build a Flex Mobile App in Five Minutes Using FlashBuilder 4.5 to build iOS apps 10 Essentials for Developing Commercial Flex Mobile Apps Migrating from Desktop to Mobile I hope that helps, -Andy
... View more
01-22-2013
06:01 AM
|
0
|
0
|
1168
|
|
POST
|
Make sure your project contains a reference to an Android library (right click project > Properties > Android and verify that a Project Build Target is checked) If the project does contain a valid reference to an Android library, you may need to right click on your project > ArcGIS Tools > Fix project properties -Andy
... View more
11-29-2012
10:10 AM
|
0
|
0
|
756
|
|
POST
|
@mark, hmmm...I'm not clear on what you are trying to accomplish. Can you please provide details on your requirements? And, what would you like to happen in the application once the touch listener event happens? -Andy
... View more
11-29-2012
08:12 AM
|
0
|
0
|
477
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-10-2026 08:29 AM | |
| 1 | 03-26-2026 03:12 PM | |
| 2 | 02-21-2026 10:23 AM | |
| 2 | 08-01-2025 06:20 AM | |
| 1 | 05-27-2025 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|