Monday, February 17, 2014

Build Flex Apps for Unsupported Locale

This is a bit off mobile topic but I think it's a very important issue that can be hard to solve for everyone that is building flex apps for other locale different from the common ones.

Since version 3.2 of ArcGIS for Flex, Portuguese (pt_PT) locale is supported, but if you change your Flex project to Portuguese you will get compilation errors. This article will guide you on how to overcome this problem with any language.
When you want to change the locale of your flex app, the first step is going to the project properties (right mouse click on your project's root). In Flex Compiler you will find in the arguments box:
-locale=en_US -source-path=locale/{locale} -keep-all-type-selectors=true
Change en_US for the target localization (in my case pt_PT ). Close Properties and compile. You will get the following error:
unable to open 'C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\frameworks\locale\pt_PT'
Now this is strange because ArcGIS for Flex supports pt_PT localization.
Checking ArcGIS Flex's Help, in the Localization section is stated:
"Adobe 4.6.0 supports 16 locales out of the box (see your Flash Builder install, for example, C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\frameworks\locale), while Apache Flex 4.10.0 supports 23 different locales. This still leaves seven locales supported by Esri that are not supported by the underlying Flex SDKs."
This Esri’s document also helps out on how to copy an existing locale, giving it a new name, but if you want to create a whole new localization files, let’s say, Portuguese,  you will have to translate the copied files.
But first things first! Let’s start by copying existing locale files.
1. Open the windows command line with administration privileges.

2. Type the path of your Flash builder installation directory, for example cd "C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\bin".

3. In my case I will copy the existing pt_BR to a new pt_PT because the language is quite similar. This way I won’t have much work on translating the files.
Type copylocale pt_BR pt_PT. This will create localization files for pt_PT but with the same words as pt_BR.
If you want to copy, for example, from English to Hungarian you should type copylocale en_US hu_HU.

4. In the file explorer go to C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\frameworks\locale and you will find the new created folder pt_PT. If you don’t find it this could mean that you are not running command line with administration privileges.

5. Back to Flash Builder, in the project’s properties argument box, set the locale to pt_PT, like this
-locale=pt_PT -source-path=locale/{locale} -keep-all-type-selectors=true

6. Clean and compile the project. The error will go away and the localization strings will be set to the copied locale. Check, for instance, map tool tips and month names in calendar controls.
The next step is to translate the localization files with the correct words.

1. Go back to file explorer. In C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\frameworks\locale\pt_PT  you will find ten .swc files. These files are where you will find localization strings.

2. In order to access and change this files you will have to extract, or unzip, every file with a normal packaging software like WinZip or 7Zip. You will probably get a “Access denied” error when unzipping the files, so copy every file to another location like your desktop.

3. Inside each extracted .swc you will find the folder \locale\pt_PT. Inside of this folder there are the localization strings.

4. With a lite text editor like Notepad++ edit each file to translate its string without changing the file format



5. After translating all the files you need to package the files again. Many posts on the web and even Adobe’s documentation point out to running a flex command line torecreate the .swc files but I couldn’t put it to work. I always got errors. So what I did was opening the original package files, one by one, with the packaging software and dragged and dropped the translated files back to its sources. Pay special attention to copy the files to the same location inside the package without changing the .swc original file structure.
6. The final step is to copy the translated .swc files back to C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\frameworks\ locale\pt_PT.
7. Compile and run the app.
Good Luck


Wednesday, December 11, 2013

ArcGIS for Windows Mobile Licensing




One common question when implementing and designing a full field collection solution is, what type of licensing do I need in order to use ArcGIS for Windows Mobile (AGM).

In the early versions of AGM you would only get authorization with an ArcGIS for Server (AGS) Advanced Enterprise license, and you could only synchronize your data, between field and office, with a service publish on AGS. But starting with 10.1 if you have ArcGIS for Desktop you will also get one AGM license and you are able to synchronize your data with local Geodatabases.

Having said that, you can install, collect and synchronize your field data with your office data having a Desktop Licence or a Server Licence. Conditions following.

ArcGIS for Desktop

  • AGM is available with Basic, Standard and Advance licensing;
  • You get one mobile deployment for each desktop license;
  • If you need more mobile deployments you can purchase additional packs of 5 or 50 deployments;
  • You will be able to synchronize your field data with local Geodatabases with your ArcGIS Desktop software. 

ArcGIS for Server

  • With an Advanced Enterprise license you will get unlimited mobile deployments and you will be able to create mobile capable services. This services are responsible for the synchronization of your data between your mobile and server;
  • With Advanced Workgroup and Standard Enterprise licensing you server is mobile ready but if you want to use AGM you will have to buy mobile deployment packs of 5 or 50;
  • The remaining Server licensing do not allow the use of AGM.

It is my understanding that the mobile deployment is the equivalent of field workers you have deployed on the field at one specific time or project. As an example, if you have one ArcGIS for Desktop license, you can have only one member of your team collecting and synchronizing data. If you want to have a team of 8 field workers collecting data, you will have to buy two packs of 5 mobile deployments. 



Monday, November 4, 2013

ArcGIS Mobile 10.2 and the Windows Sensor and Location Platform

Starting from Windows 8 the connection to the GPS receiver is no longer supported by COM Ports. Instead Microsoft developed what they call 'Windows Sensor and Location Platform'. This platform eases the connection to the many location techniques that are available on the device like Wi-Fi triangulation, IP address or GPS device. This is a quite new platform and a some hardware vendors support both modes.

O ArcGIS Mobile 10.2 does no yet support this functionality which will only be available on the second quarter of 2014.

For now there are two workarounds for this problem:

1. Install ArcGIS Mobile 10.1 or 10.2 with Windows 7 and connect to the devices COM Port;
2. Install ArcGIS Mobile 10.1.1 with the ‘Location API Connection Extension for AGM 10.1.1’ provided by Esri.

I have tested option 2 on two devices and it works fine. This extension does not work with ArcGIS Mobile 10.2.

This extension comes with a readme file that states 'Copy files inside ReleaseAssemblies Folder into C:\ProgramData\ESRI\ArcGIS Mobile\Extensions. ArcGIS for Windows Mobile tablet application will use Location API instead of COM port.'

If you don't have this path on your device, just create it and copy the files. Don't forget to restart ArcGIS Mobile App. Then go the GPS Settings and Status and check the Windows Location API Settings.



Good Work!

Monday, February 11, 2013

ArcGIS Flex application on Adobe AIR

I have been doing some tests on how can one port an ArcGIS Flex Web Application to a desktop AIR App. To my surprise it was quite simple, fast and, most of all, everything worked on the first run.
This is what I did. My objective was to port ArcGIS Viewer for Flex to an ArcGIS AIR Application.

First of all I downloaded ArcGIS Viewer for Flex 3.1 source code, available on GitHub, and imported it to my Flash Builder workspace


Create a new Flex Project in File -> New -> Flex Project
Type a project name like ArcGISFlexDesktop and select Desktop (run in Adobe AIR)


For the next options go with the default.

Now that the project is created, expand folder src - (default package) and open the file ArcGISFlexDesktop.mxml. Also, on the FlexViewer Project, expand folder src - (default package) and open the file index.mxml



As you can see from the above image, the desktop application entry point is the s:WindowedApplication. As for the web application it’s the s:Application. So the first action is to copy the contents inside the s:Application tag, properties included, and paste them inside the s:WindowedApplication. 


Next, copy the selected  files (see image below) from the FlexViewer project to the ArcGISFlexDesktop project. The project structure must be the same for both projects.

    


The next step is to add all the modules to the project. Go to Project - Properties and then in the ArcGISFlexDesktop Properties dialog select Flex Modules and add the following mandatory widgets.
  1. HeaderControllerWidget.mxml
  2. InfoPopupWidget.mxml
  3. WidgetContainerWidget.mxml
  4. OverviewMapWidget.mxml
  5. NavigationWidget.mxml
  6. MapSwitcherWidget.mxml
I also added BookmarksWidget.mxml and QueryWidget.mxml but you can add all.

Finally you must copy the compiler arguments from the FlexViewer project to the ArcGISFlexDesktop project. Right click on the FlexViewer project and select Properties. Then go to the Flex Compiler tab and copy the text from the Addicional compiler arguments box. Paste this text into the same box on the ArcGISFlexDesktop project.


You’r all done! Press the run button and there you have it! An ArcGIS Flex AIR application.


To my surprise, porting a web Flex app to a Desktop AIR app was so easy that some questions came up. Why did Esri launch an ArcGIS runtime for Silverlight (WPF) and for Java but not for Flex. There are not even news or plans.

The ArcGIS runtime is intended to work in online and offline modes. For the offline mode map tile packages are used, so the app needs to access the local file system. Flex RIA has the capabilities to access local file system so I have no clue on why there are no plans on making an ArcGIS Runtime based on Flex.

Download the installer of ArcGIS Flex Viewer for Desktop

Wednesday, December 5, 2012

Add New Devices to a Mobile Provisioning Profile


On my previous post I wrote on how to create an iOS relase build for ad-hoc distribution. But soon after I created and published a release build for a cliente, I was confronted with an aditional challenge. What if I want to add additional devices to the distribution package?
If you do a small search on the web and forums the news you’ll get is that you have to go through the complete packaging process again and again for each new device.
The news I have is: YOU DON’T!! What you have to do is update the existing mobile provisioning profile with the new device’s ID and distribute it along side with the original application's package. 

Here’s a step by step.

Get the device’s Unique Identifier

The first step is to get the unique identifier of the device
  1. Connect the device to the computer via USB
  2. Start iTunes
  3. In iTunes select, in the right column, the device
  4. On the Summary tab press on the text of Serial Number


  1. After pressing the text displays the identifier (UDID)
  2. Press Ctrl + C (Windows) Cmd + C (Mac)


Add the new device to your company’s Apple account

  1. Go to https://developer.apple.com/membercenter and log in
  1. Press iOS Provision Portal
  1. On the left column select Devices
  2. At right press the Add Devices button
  1. In Device Name field assign a intuitive  name to the device.
  2. Fill the the device’s ID field with UDID you copied earlier
  1. If you need to add more equipment press the + button to the right
  1. At the end press Submit and the new equipment is added

Associate the new device to the application’s distribution license

  1. In the left column press Provisioning
  2. Select the Distribution tab
  1. In the row that corresponds to the distribution license press Edit on the right and then select Modify
  1. In the Devices Section you should see the newly added. Select it, and all the devices you wish to assign to the license
  2. Submit Press when finished
  1. After you press Submit the license status may be in Process. If this happens press the F5 key to refresh the page. The status should switch to Active.
  1. Press the Download button to download the license file. The file name is [LicenceFileName].mobileprovision

Distribute your licence and app files

There are two ways you can send the application and licence files to your users.
  1. One is by email. Then the user can install both files with iTunes. First the licence file and then synchronize the application file.
  1. The other way is to publish both files on a web server just like on this previous post.
In order to go with the second option, follow these steps.
  1. Go to this previous post and follow the same last steps on how to configure the webpage
  2. Then on the index.html file you must add also a link to the licence. The complete code is as follows
<body style="height: 100%;">
  <ul>
    <li>
<a href="http://[ServerName]/[LicenceFileName].mobileprovision">
Download Licence</a>
    </li>
    <li>
       <a href="itms-services://?action=download-manifest&url=
               http://[ServerName]/[AppFileName].plist">
           Download Application</a>
    </li>
  </ul>        
</body>
  1. You also must add a new MIME type for the licence file
.mobileprovision application/octet-stream
This web page will have two links. One for the licence file and the other for the application installation package.
The application package is the same that was generated on this previous post.
Installing the application in new devices
To install the application, you must first install the licence and then the application. Send the link of the webpage by email.
  1. To install the licence you must click on the Download Licence link
  2. Install the licence clicking on Install
  1. After the licence is installed. Press OK.
note: If when downloading the certificate an error message appears, this can mean that the device is not authorized to use this application, that is, the UDID of this device is not associated with the licence
  1. Return to the web page and click Download Application. This will initiate the download and installation of the application.
And you’re done. If you need to add more devices, just repeat the process. At the end, on the webpage, replace only the licence file (.mobileprovisioning file).

Wednesday, October 24, 2012

Making a Release Build for Ad-Hoc Distribution of an iOS App


Making a release build for the app store or for distributing an app in your company is always a pain in the neck. Apple insists on changing the process for each version of XCode, changing the rules,  changing licences, once or twice a year. There are numerous articles and blog post on the web that will try to help you build a release version of your app. I say try because it’s hard to find an up-to-date article that will fit your XCode and Mac OS version.
So, this is my contribution to the confusion of articles on making a release build for an iOS App.

On the 29th of August of 2012 with XCode 4.4, Mac OS Lion 10.7.4 and iOS 5 these are the steps on making a release build for Ad-Hoc distribution of an iOS app.


First go to https://developer.apple.com and log in. The page will look like this




Register Devices

The devices to which you intent to install your app need to be registered in your account.

Click on iOS Provisioning Portal


Click on Devices and the on Add Devices


To add a Device you need any name and a Device ID. To get the Device ID you have to

  1. Connect your device to your Mac
  2. Open Itunes
  3. On the summary page
  4. In there you will see the Serial Number of your device
  5. Click on the Serial Number and you will see the Device ID
  6. Click command-c (Mac) or ctrl-c (Windows) to copy it to the clip board. You can then paste it on the iOS Provisioning Portal or send it by email to whoever is registering your device





Give a name to the device and the Device ID and click Submi. You can register up to 100 devices.





Create an App ID


Your app must have an AppID

Click App IDs. On the tab Manage click New App ID.



  1. Write a intuitive name for your App ID in the Description
  2. Select your Team ID. You should have one from your Apple Developer License
  3. The Bundle Identifier must be the same as in your Project. Go to XCode to get it
  4. Submit



Create the Distribution Provisioning Profile


On the same page click on Provisioning on the left, then the Distribution tab and then New Profile button



  1. Select Ad Hoc
  2. Choose a intuitive profile name
  3. Click New Profile button



After submitting the profile it will be available in the profiles page. Once it is active, should take a few seconds (must refresh the page), you can download it.


After downloading the profile you must install it on XCode. You can drag and drop the file to your XCode icon



After this the XCode’s Organizer will open and you can check for the profile




Create the Distribution Archive


Now back to  XCode. Select the Project and the info tab.


In the configuration Table add a new configuration. Click the plus sign to duplicate the Release configuration



Name the new configuration Ad-Hoc. It will look like this at the end.


Now, still in the Project view, go to Build Setting tab.
The Ad-Hoc configuration is in the Code Signing Identity table.
In the row named Ad-Hoc and sub-row named Any iOS SDK click on the AdHocTestApp row to select a profile


And select the profile you created on the Apple Developer Portal


Next, click on the Scheme selection button on the top left


and select Edit Scheme


Select Archive on the left.
Select the Ad-Hoc Build Configuration and click Ok



You are now all set up ( Finally!!! ) to create the distribuition package.

  1. Click on the Scheme selection button and select iOS Device
  2. Build you App
  3. After it finishes select Archive


The Organizer window will open after the archiving finishes

Now click on Distribute

Select Save for Enterprise or Ad-Hoc Deployment


On the next window choose your Ad-Hoc profile and click next.




Select where you want to save the .ipa package, I chose the desktop.


At this point you have two choices regarding Save for Enterprise Distribution check box

  1. Install the app through iTunes. Leave it uncheked
  2. Download and Install the app on the iPhone through a webpage.  Check it.

If you choose the first option the file AdHocTestApp.ipa will be created on the desktop and you can now drag and drop it to you iTunes and then synchronize the app. The Profile you created is embedded in .ipa package. And you're done! Congratulations!!


Or not... If you choose the second option there are still a few more steps. So keep reading.

  1. Choose a name for the package
  2. Check the Save for Enterprise Distribution option
  3. Type the URL of the location of the .ipa in your server
  4. Add a title

I haven’t tested the subtitle and image URLs yet.

Click save.

This will generate two files in your desktop

  • AdHocTestApp.ipa
  • AdHocTestApp.plist

You have to copy this files to your server to the location you specified above


The next step will be creating a web page form which you can donwload the app. This is the simplified version.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>AdHoc Test App</title>
</head>
<body>
  <ul>
<li>
<a href="itms-services://?action=download-manifest&
Tap here to install AdHocTestApp
</a>
  </li>
  </ul>
</body>
</html>

Notice that the href link is not the .ipa but .plist


You are all done!

note: in my case I am using an Microsoft server and I had to add the corresponding MIME Types for the .ipa and .plist. (no screen shots, sorry)

  1. Go to IIS Manager
  2. Locate you web site folder
  3. Right click and select Properties
  4. Open HTTP Headers tab
  5. Click on MIME Types button at the bottom
  6. Click New... button and add these two
    1. .ipa application/octet-stream
    2. .plist text/xml

Now, on your device, navigate to the page and download and install the app.

          


Good Luck!!