POST
|
Solved. //LicenseInfo licenseInfo = new LicenseInfo(licJson); // EXPIRED
LicenseInfo licenseInfo = LicenseInfo.fromJson(licJson); // VALID
Miracle!
... View more
12-03-2017
11:25 PM
|
1
|
0
|
438
|
POST
|
Hi all. Each time application starts, we set license. Each time created from JSON string license is expired. It's offline application. We need to set license without internet connection, without asking each time from portal. How to? private void setupEsriLicense() {
try {
appSettings = getSharedPreferences(Global.SETTINGS_FILE, MODE_PRIVATE);
boolean getFromPortal = true;
if (appSettings != null && appSettings.contains(Global.LICENSE_TAG)) {
String licJson = appSettings.getString(Global.LICENSE_TAG, null);
LicenseInfo licenseInfo = new LicenseInfo(licJson);
LicenseResult licenseResult = ArcGISRuntimeEnvironment.setLicense(licenseInfo);
LicenseStatus licenseStatus = licenseResult.getLicenseStatus();
// licenseStatus is always EXPIRED
if (licenseStatus == LicenseStatus.VALID) {
getFromPortal = false;
}
}
if (getFromPortal) {
UserCredential credential = new UserCredential("username", "passwd");
final Portal portal = new Portal("https://companyname.maps.arcgis.com");
portal.setCredential(credential);
portal.loadAsync();
portal.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
if (portal.getLoadStatus() == LoadStatus.LOADED) {
LicenseInfo licenseInfo = portal.getPortalInfo().getLicenseInfo();
LicenseResult licenseResult = ArcGISRuntimeEnvironment.setLicense(licenseInfo);
LicenseStatus licenseStatus = licenseResult.getLicenseStatus();
if (licenseStatus == LicenseStatus.VALID) { // always VALID
SharedPreferences.Editor editor = appSettings.edit();
editor.putString(Global.LICENSE_TAG, licenseInfo.toJson());
editor.commit();
}
//TODO: remove from release
License runtimeLicense = ArcGISRuntimeEnvironment.getLicense();
Calendar cal = runtimeLicense.getExpiry(); // always +30 days
LicenseStatus ls = runtimeLicense.getLicenseStatus(); // always VALID
LicenseLevel ll = runtimeLicense.getLicenseLevel(); // always BASIC
LicenseType lt = runtimeLicense.getLicenseType(); // always NAMED_USER
}
}
});
}
} catch (Exception ex) {
Log.d(TAG, "setupEsriLicense", ex);
}
}
Thanks for your ansewers.
Ivan
... View more
11-28-2017
11:56 PM
|
0
|
1
|
608
|
POST
|
We got solution for this problem. Database developer (not me) removed some relations, and now it works. But my question is still opened: why release SDK returns fatal RuntimeException, but not TableException. Why canDelete returns true? Thanks.
... View more
10-17-2016
06:23 AM
|
0
|
0
|
600
|
POST
|
Alexander, sorry for my bad English. Not joined, but related. Related with two another tables.
... View more
10-05-2016
10:49 PM
|
0
|
4
|
600
|
POST
|
We have a myGeodatabaseFeatureTable joined related with two another tables. I can add, I can edit, but I can't delete feature from this table. myGeodatabaseFeatureTable.canDelete(featureId); // true myGeodatabaseFeatureTable.deleteFeature(featureId); // AndroidRuntime: FATAL EXCEPTION java.lang.RuntimeException: Abort due to constraint violation at com.esri.core.geodatabase.GeodatabaseFeatureTable.nativeDeleteRows(Native Method) at com.esri.core.geodatabase.GeodatabaseFeatureTable.deleteFeatures(SourceFile:212)
... View more
10-05-2016
04:40 AM
|
0
|
6
|
1659
|
POST
|
Indra, * one way - Using Singleton * another way - look at the viewer code find class AppEvent.as public static const REFRESH_LEGEND : String = "refreshLegend"; it used to refresh legend widget, so LegendWidget has listener attached during initialization AppEvent.addListener(AppEvent.REFRESH_LEGEND, legendRefreshHandler, false, 1); You can add to AppEvent.as own code public static const REFRESH_MY_WIDGET_NR_2:String = "refreshMyWidgetNr2"; in SecondWidget code initialization add listener function (you can add it in other places too) AppEvent.addListener(AppEvent.REFRESH_MY_WIDGET_NR_2, widgetRefreshHandler, false, 1);
...
private function widgetRefreshHandler(event:AppEvent):void
{
// right place to refresh
// read sended data
// var sendedData:Object = event.data;
} In FirstWidget code var sendedData:Object = null;
AppEvent.dispatch(AppEvent.REFRESH_MY_WIDGET_NR_2, sendedData); ------------- AppEvent class is good helper in ArcGIS FlexViewer application - it has many needed functions, it is extendable ... 🙂 Good luck
... View more
10-28-2013
12:10 AM
|
0
|
0
|
470
|
POST
|
Albert, you can quickly create own utility, like this: package ee.alphagis.utils
{
public class SPUtils
{
/**
* @param wkid Well-known ID
* @return spatial reference <b>Well-known Text</b> by input Well-known ID, or <b>null</b> if not found
*/
public static function returnTextById(wkid:Number):String
{
var result:String = null;
switch (wkid)
{
case 3819:
{
result = "GEOGCS[\"GCS_HD1909\",DATUM[\"D_Hungarian_Datum_1909\",SPHEROID[\"Bessel_1841\",6377397.155,299.1528128]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]"
break;
}
case 3821:
{
result = "GEOGCS[\"GCS_TWD_1967\",DATUM[\"D_TWD_1967\",SPHEROID[\"GRS_1967_Truncated\",6378160.0,298.25]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]";
break;
}
//TODO: add needed cases here
default:
{
break;
}
}
return result;
}
/**
* @param wkid Well-known ID
* @return spatial reference <b>name</b> by input Well-known ID, or <b>null</b> if not found
*/
public static function returnNameById(wkid:Number):String
{
var result:String = null;
switch (wkid)
{
case 3819:
{
result = "GCS_HD1909"
break;
}
case 3821:
{
result = "GCS_TWD_1967";
break;
}
//TODO: add needed cases here
default:
{
break;
}
}
return result;
}
/**
* @param wkid Well-known ID
* @return spatial reference <b>Well-known Text</b> by input name, or <b>null</b> if not found
*/
public static function returnTextByName(name:String):String
{
var result:String = null;
switch (name)
{
case "GCS_HD1909":
{
result = "GEOGCS[\"GCS_HD1909\",DATUM[\"D_Hungarian_Datum_1909\",SPHEROID[\"Bessel_1841\",6377397.155,299.1528128]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]"
break;
}
case "GCS_TWD_1967":
{
result = "GEOGCS[\"GCS_TWD_1967\",DATUM[\"D_TWD_1967\",SPHEROID[\"GRS_1967_Truncated\",6378160.0,298.25]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]";
break;
}
//TODO: add needed cases here
default:
{
break;
}
}
return result;
}
}
} it based on coordinate systems id's reference, published by ESRI team
... View more
07-09-2013
03:21 AM
|
0
|
0
|
467
|
POST
|
playing with com.esri.ags.layers.supportClasses.LayerInfo 😉 <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:esri="http://www.esri.com/2008/ags" creationComplete="onAppCreated(event)"> <s:layout> <s:VerticalLayout gap="5" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" /> </s:layout> <fx:Script> <![CDATA[ import com.esri.ags.events.LayerEvent; import com.esri.ags.layers.ArcGISDynamicMapServiceLayer; import com.esri.ags.layers.supportClasses.LayerInfo; import mx.collections.ArrayCollection; import mx.collections.ArrayList; import mx.collections.IList; import mx.controls.Alert; import mx.controls.Label; import mx.events.FlexEvent; import mx.utils.StringUtil; import spark.components.ComboBox; import spark.components.DataGrid; protected function onAddLayerClick(event:MouseEvent):void { const serviceUrl:String = txtService.text; const visibleLayers:Array = txtLayers.text.length > 0 ? txtLayers.text.split(",") : null; const layerName:String = txtName.text; var dLayer:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(); dLayer.url = serviceUrl; if (visibleLayers && visibleLayers.length > 0) { dLayer.visibleLayers = new ArrayList(visibleLayers); } if (layerName.length > 0) { dLayer.name = layerName; } dLayer.addEventListener(LayerEvent.LOAD, onLayerLoad); dLayer.addEventListener(LayerEvent.LOAD_ERROR, onLayerLoadError); map.addLayer(dLayer); } protected function onLayerLoad(event:LayerEvent):void { var lbl1:Label = new Label(); lbl1.text = StringUtil.substitute("Layer '{0}' added", event.layer.name); infoContainer.addElement(lbl1); var dLayer:ArcGISDynamicMapServiceLayer = event.layer as ArcGISDynamicMapServiceLayer; var visibleLayers:IList = dLayer.visibleLayers; if (visibleLayers) { var lbl2:Label = new Label(); lbl2.text = StringUtil.substitute("Defined visible layers ids are: {0}", visibleLayers.toArray().toString()); infoContainer.addElement(lbl2); } if (dLayer) { var layerInfoGridProvider:ArrayCollection = new ArrayCollection(); var layerInfoComboBoxProvider:ArrayCollection = new ArrayCollection(); for each (var lInfo:LayerInfo in dLayer.layerInfos) { // for data grid var layerInfo:Object = new Object(); layerInfo.Id = lInfo.layerId; layerInfo.Name = lInfo.name; layerInfo["Default Visibility"] = lInfo.defaultVisibility; if (int(lInfo.minScale) == 0 && int(lInfo.minScale) == 0) { layerInfo["Visible at scales"] = "Not set"; } else { layerInfo["Visible at scales"] = int(lInfo.minScale) + " - " + int(lInfo.maxScale); } if (visibleLayers && visibleLayers.length > 0) { layerInfo["In set of visible layers"] = visibleLayers.getItemIndex(lInfo.layerId.toString()) != -1 ? true : false; } else { layerInfo["In set of visible layers"] = "-"; } layerInfoGridProvider.addItem(layerInfo); // for combo box if (visibleLayers && visibleLayers.getItemIndex(lInfo.layerId.toString()) != -1) { layerInfoComboBoxProvider.addItem(lInfo); } } var comboBox:ComboBox = new ComboBox(); comboBox.dataProvider = layerInfoComboBoxProvider; comboBox.labelField = "name"; infoContainer.addElement(comboBox); var infoGrid:DataGrid = new DataGrid(); infoGrid.percentWidth = 100; infoGrid.scroller = null; infoGrid.dataProvider = layerInfoGridProvider; infoContainer.addElement(infoGrid); } } protected function onLayerLoadError(event:LayerEvent):void { Alert.show(event.fault.faultString, "Error"); } protected function onAppCreated(event:FlexEvent):void { const message:String = "Examples of map services to test are \n" + "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/MapServer" + "\nor\n" + "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/LandusePlanning/MapServer"; Alert.show(message, "Info"); } ]]> </fx:Script> <s:HGroup width="100%"> <s:Button label="Add Dynamic Layer" click="onAddLayerClick(event)"/> <s:TextInput id="txtService" width="100%" prompt="servername/arcgis/rest/services/servicename/MapServer"/> <s:TextInput id="txtLayers" width="100%" prompt="comma separated visible layers (not required)"/> <s:TextInput id="txtName" width="100%" prompt="set layer name (not required)"/> </s:HGroup> <s:Panel id="panelMap" title="Map" width="100%" height="100%"> <esri:Map id="map" extentChange="{panelMap.title = 'Map at scale 1:'+map.scale.toFixed()}"/> </s:Panel> <s:Panel title="Info" height="100%" width="100%"> <s:Scroller width="100%" height="100%"> <s:VGroup id="infoContainer" width="100%" height="100%" /> </s:Scroller> </s:Panel> </s:Application> P.S. ArcGIS api v. 3.3, Flex SDK v. 4.9
... View more
06-10-2013
12:01 AM
|
0
|
0
|
295
|
POST
|
... please help me with some code ... Similar question with example code.
... View more
06-03-2013
12:32 AM
|
0
|
0
|
309
|
POST
|
- Initialize layer, - getDetails() method for ArcGisDynamicMapServiceLayer or - layerDetails property for FeatureLayer. - All the necessary information in your hands.
... View more
06-01-2013
09:54 PM
|
0
|
0
|
309
|
POST
|
Hi all. Each time new ArcGIS API for FLEX released, we can bate one's curiosity learning Bug fixes list. Is there any published list of "ArcGIS API for FLEX known issues" like Flex Viewer issues list or Apache Flex issues dashborad or this or just a list of known, but not fixed actual bugs? Thx.
... View more
05-24-2013
12:25 AM
|
0
|
1
|
593
|
POST
|
Magic scroll bar in (1)flash, in (2)web browser on (3)client side appears and disappears bescause some service is restarted on (4)server? Right? Hmmm I think that the table container or the table itself does not have the correct dimensions. similar questions: Scrollbar Issue ... Disappearing scrollbars ... ...
... View more
05-21-2013
11:16 PM
|
0
|
0
|
138
|
Title | Kudos | Posted |
---|---|---|
1 | 12-03-2017 11:25 PM | |
1 | 10-06-2016 11:49 PM | |
2 | 06-07-2012 01:38 AM | |
1 | 06-03-2012 09:42 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|