QueTwo's Blog

thouoghts on telecommunications, programming, education and technology

Tag Archives: iPhone

Adding a GPS-driven map to your Adobe AIR app

Over the next few blog posts I’m going to be writing about some of the cool little features I implemented in a recently released app I worked on — Pointillism.  It is pretty rare that I can talk about an app I’ve released, but the verbiage in this contract allows me to :)

On the admin interface of the app, the customer wanted to be able to add a “point” to the game.  A point is a destination that the end user is looking for in this virtual scavenger hunt.  In order to have the admins be able to visually see what their GPS was returning, we wanted to map the location, as well as the bounding area that they wanted people to be able to check in to.  While our admin interface was pretty basic, the functionality had to be there :

GPS and Map solution on iOS and Android

While most people would instantly reach for Google Maps, we decided to use ESRI’s mapping solution.  They offer a very accurate mapping solution that is consistent across all the platforms in addition to being very flexible   The one thing that Google Maps had a hard time providing us was the ability to draw the fence in a dynamic manner, built with realtime data that came from within our app.  It was important for us to be able to see the current location, and the valid locations where people could check into for that point.  The hardest thing was having the ESRI servers draw the circle (known as a buffer).  ESRI’s mapping platform is available for use FOR FREE, with very limited exceptions.  As a bonus, they have an entire SWC and already pre-built for Flex/AIR.

So, how was it done?  It was actually pretty simple :

    1. Add the SWC from ESRI’s website to your project.
    2. Add their mapping components to your MXML file.  We added the mapping layer and then a graphic layer (where the circle is drawn).  The mapping layer, we pointed to ESRI’s public mapping service.
      <esri:Map id="locMap" left="10" right="10" top="10" bottom="150" level="3" zoomSliderVisible="false"
       logoVisible="false" scaleBarVisible="false" mapNavigationEnabled="false">
       <esri:ArcGISTiledMapServiceLayer
       url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
       <esri:GraphicsLayer id="trackingLayer"/>
       </esri:Map>
    3. We added a few components to the MXML’s declaration section.  This included the defination of the “symbol” (the circle itself), and the Geometry Service (the thing that figured out how to draw the circle in the correct place).
       <fx:Declarations>
       <esri:SimpleFillSymbol id="sfs" color="0xFF0000" alpha="0.5">
       <esri:SimpleLineSymbol color="0x000000"/>
       </esri:SimpleFillSymbol>
       <esri:GeometryService id="myGeometryService"
       url="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>
       </fx:Declarations>
    4. Next, we had to write some code to update the map and draw the circle in the correct place.  This involves a few steps, including taking the GPS coordinates from our GPS device, and creating a new “MapPoint” which holds those coordinates.  A MapPoint is exactly that, a single point on the map.  The thing about ESRI’s service is that it knows a LOT of different map coordinate systems — so you need to make sure you choose one that makes sense.  In our case, our GPS is returning back data in WebMercator format (lat/lon) other known as Spatial Reference number 4326, so that is what we are going to use to project that point to center our map.  Finally, we will ask the Geometry Service to return a “buffer” of a series of points that represents a circle x feet around the center of our map.   When the buffer is returned from the web service, we draw it using our graphic we setup earlier and push it to Graphics Layer that is sitting on top of our map.  This all happens in a matter of seconds.
      protected function gotGPS(event:GeolocationEvent):void
       {
       var mp:MapPoint = new WebMercatorMapPoint(event.longitude, event.latitude);
      updateMapWithFence(mp);
       locMap.scale = 4000; //this is a magic number for the zoom level I wanted.
       locMap.centerAt(mp);
       lastPoint = mp;
       }
      protected function updateMapWithFence(mp:MapPoint):void
       {
       var bufferParameters:BufferParameters = new BufferParameters();
       bufferParameters.geometries = [ mp ];
       bufferParameters.distances = [ checkinDistance.value ];
      bufferParameters.unit = GeometryService.UNIT_FOOT;
       bufferParameters.bufferSpatialReference = new SpatialReference(4326);
       bufferParameters.outSpatialReference = locMap.spatialReference;
      myGeometryService.addEventListener(GeometryServiceEvent.BUFFER_COMPLETE, bufferCompleteHandler);
       myGeometryService.buffer(bufferParameters);
       }
      private function bufferCompleteHandler(event:GeometryServiceEvent):void
       {
       trackingLayer.clear();
       myGeometryService.removeEventListener(GeometryServiceEvent.BUFFER_COMPLETE, bufferCompleteHandler);
       for each (var geometry:Polygon in event.result)
       {
       var graphic:Graphic = new Graphic();
       graphic.geometry = geometry;
       graphic.symbol = sfs;
       trackingLayer.add(graphic);
       }
       }

And that is about it!  cross-platform mapping made pretty easy.  The cool thing about ESRI’s mapping solution is the power behind it.  They offer things such as the typical driving directions all the way though “How far can a user see if they stand on the ground at this point”.   Since the components are native to your AIR app, they are fast and behave like you expect it to, without the mess of having an HTML overlay in your app.

Creating Mobile Applications from a Photoshop Prototype

Thanks to Dr. Coursaris for this photo.

At the WUD Conference, East Lansing, MI

This past Thursday, I was given the opportunity to present on a really cool, but obscure topic — creating mobile applications from Photoshop prototypes, for the World Usability Day Conference.  Essentially, my job was to show people a workflow that is possible when using Adobe Device Central to create a Photoshop file, that is then turned into a working prototype using Adobe Catalyst, and then programmed using Adobe Flash Builder. 

All in all, the conference was excellent, and I was honored to be on stage after notable presenters from the State of Michigan, Motorola, Nokia and well, even the University of Michigan.  The focus of this year’s conference was on usability, and how it relates with mobile applications and devices, which was a perfect match for the presentation I was doing.

After my quick introduction to the subject, I demoed making a complete application from scratch and deployed it to a series of working phones.  I was able to accomplish this workflow in under a half hour, which was completely amazing for not only myself, but the audience too.  It is really cool to realize that the technologies that I’ve been using as betas for so long have actually matured to the point where I can use them to make real applications.

The session was recorded and hopefully will be posted online soon.  You can view my powerpoint here (I did have to disable the live voting, but I did keep the results for historical purposes), and download ALL the source code that and asset files that we used during the presentation here.  Please keep in mind, that the logos in the demo code are subject to the use standards found here

Thanks to the WUD East Lansing team for inviting me!

Three strikes, and your out Apple!

In the past few weeks, there have been disappointment after disappointment coming out from Apple for developers.  While the iPad seems to have made a big splash news-wise, its release has been lightly overshadowed by some other announcements from Apple — the iPad will not allow Flash, Java or Silverlight content within the browser. 

In the past, the world just ‘understood’ that the Flash player wouldn’t work on mobile devices — these are devices that are measured in inches, not GHz, and have to operate in very loosely connected environments (AT&T).  We accepted this, but of course wanted it so we could experience the entire web. 

With the introduction of the iPad, a “computer replacement” device, there really is no more excuse.  The technology works, and has been proven.  All of a sudden a press release goes out claiming Flash would shorten battery life, would make the device hot, and catch on fire, etc.  The list goes on as to why Flash shouldn’t be included.  As people started to get the devices in their homes, the reviews were consistently “this device would be much better if it had Flash”  or “I miss Flash.”

Earlier this week, Apple dropped another bomb — Applications submitted to the store to work on the iPhone / iPad / iTouch cannot utilize gestures designed for their own applications.  For example, the pinch to expand gesture is reserved for Apple created applications ONLY — new applications have been denied access to the store because they emulated these features.  This is a huge mis-step in the UX world.  In UX, there is a general feeling that gestures and human interactions should be consistant between applications.  This is why Windows became so wildly popular — if you figured out how to use one Windows application, you figured out how to interact with most of them.  Apple doesn’t want that the be the case — they want to have the “Apple” way, and the “other” way.

Finally, a draft copy of the new EULA that will be included with the iPhone OS 4 SDK was released.  This EULA has some provisions in it that make some very large and sweeping restrictions on HOW you create your applications. 

Up until now, the major restriction was that you could not execute any code that was not included and compiled in the inital application (for example, runtimes like AIR and .NET would not be possible).  The theory behind this was about security — they didn’t want malicious code to be downloaded and run on the iPhone.  This also is one of the blocks of having the Flash player on the iPhone.

However, the new SDK EULA now reads :

3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

Essentially, what this boils down to is if you want to create iPhone, iPod Touch or iPad applications, you have to use Apple’s developer’s tools, on Apple’s operating system, which only runs on Apple’s hardware.  Oh, and you have to sign Apple’s NDA, pay for their certificate, and submit to only their store.  Although there are other tools, better integrations with workflows, etc., you CANNOT use them if you wish to deploy you app to anybody (including yourself).  Oh, and if you know another language really, well, you better learn THEIR language (from scratch) and kinda make the application work.

Apple has always been about their image, and Microsoft has always been about the developers.  Microsoft’s theory has been that if you make the developers happy, they will make cool apps that people will want to use.  Apple has taken the other approach — make a cool device which will drive the consumers to demand the applications and developers.  Now, for some odd reason, Apple thinks they can punish their developers AGAIN (remember the 90’s?) for trying to serve consumer demand.

One other final thought — Some of the biggest critics of Adobe in Apple’s camp say that Adobe is lazy.  They keep showing that the Apple versions of Adobe’s products are missing features, are clumsy or are less stable.  I need to throw out there that in the last 10 years (MacOS to Snow Leapord) Apple has forced all of their application developers to migrate first from Titanium, to Carbon then to Cocoa, which for larger applications results in complete gut-jobs.  For example, if you want your application to be able to address 64-bit memory space, you MUST re-write the app in Cocoa.   How can Adobe be expected to keep both Windows and OSX feature parity if Apple is making them rewrite the app every few years?  Microsoft has allowed us to keep writing to the same libraries since Windows 95 / NT, allowing the applications to grow and create NEW features.

Well, enough ranting — here is a video Adobe showed during their MAX convention this last year on their efforts to get the Flash Player to work on the iPhone :

The truth about avoiding the phone company with VoIP

VoIP, or Voice Over IP is seen as the future of telecommunications.  In the enterprise, it took hold about 5 years ago, and about 3 years ago it became the norm for any new phone system. In the highly controlled network environment of the office, the technology flourished and eventually became rock-solid by breakthroughs made by companies like Avaya, 3com and Cisco.

Around the same time consumer-based VoIP products like Vonage started hitting the market.  These use the consumer’s internet connection and provided a dialtone like replacement for a standard phone line.  Generally these types of connections were less expensive (and in some cases, they were MUCH less expensive), but at the same time they relied on the general internet (without any quality-of-service gaurentees).  Recently there has been a lot of fanfare over Google Voice being available on various mobile devices like Google’s Android and Apple’s iPhone.  This allows users to use their data plans and bypass the cell-phone companies. The funny thing is, even AT&T sees consumers bypassing their services as a viable threat – they filed paperwork to lift the requirements that they provide phone services in their entire claimed market.

There are a few problems with this mass migration from traditional telephony services to this “wild-wild-west” VoIP services.

First off, VoIP has no concept of location-based services.  With traditional PSTN “landline” or business services, the phone company delivers your services to a physical location (your home or business).  This information is tied to a database which is given to 911 and other emergency services when you need it. Because VoIP connects over the internet, there is no real way to track where a call is physically being placed from — and the problem is exaserbated by devices like firewalls, VPN tunnels and MPLS networks.

Next, there is no concept of Quality of Service for many of these consumer devices.  Companies like AT&T in my local market offer DSL service in most areas that has a 1MB download and 256kbps upload.  This allows for a descent speed for doing things like browsing the web or reading emails.  However, if you try to use a VoIP connection you most likely will saturate this connection — and if you try to browse the internet while being on the phone (something I do quite a bit), you run a huge risk of your connection breaking up or being disconnected completely. More advanced routers and internet service providers offer QoS for connections, but these are not universal, nor are they easy to setup.  I won’t go into the reliability of internet connections in storms, power outages, etc. where quality and resiliency is a needed in emergencies.

Compatibility is another issue that is becomming apparent. There are hundreds of different “VoIP” providers out there, each with their own software or hardware application.  Companies are all trying to write their own standard (like Skype), or if they use some of the open standards (like Google), they implement them in a way that makes it very difficult to interconnect with others.  This is very similar to the beginning of the telephone network where there were lots of different networks, and none of them connected with eachother.  The government finally stepped in and created some laws (known as Common Carriage Laws) that required anybody who wanted to be a telephone provider to interconnect with each other.  Currently many VoIP providers do connect via the PSTN, but often times they charge users additional fees to do this.

Finally, we need to take a step back at the PSTN system itself.  It has become a commodity item, and even further more, it has become a so universal it is considered a utility.  In many markets it is heavily regulated by the government and has lots of redudancy, backups and, well it’s a proven technology. As more users disconnect their traditional phone lines and go with VoIP providers, less work is being put into this system and eventually that glue that holds it, along with all the PSTN providers will begin to go away.  Not only that, but because it has become such a commidity, you can get land-lines for cheap, and unlimited minutes (both in cell and landline), it makes very little sence to use these technologies other than it’s the “next best thing”.  If you don’t believe me, take a look at your VoIP provider, and compare that to a $14 phone line (unlimited local calls, and up to $0.05 a minute for long distance).

Think twice about cheering on AT&T in cutting the cord with land-line service.  It’s something that is easy and well understood.  Also think about how you plan to get internet access — and how those who are in unprofitable areas can get basic services (like phone and internet services) if companies like AT&T and Verizon are not forced to provide them.

Adobe MAX Wrap-Up

Photo Courtsy of Dee Sadler - http://www.flickr.com/photos/deesadler/So, I’m back from LA, and the Adobe MAX 2009 conference. Just like the MAX tagline of “Connect, Discover, Inspire,” I truly able to accomplish all of those.  This year’s conference packed in a lot of announcements, and gave everybody a good idea of where Adobe is heading in the marketplace.  All of the keynotes and sessions were recorded, so make sure to check them out on Adobe TV!

So, lets first talk about some of the major announcements:

  • ColdFusion 9 was released.  This has been in the works for about a year and a half, and offers a bunch of new features.  Some of the new things that are most compelling include the ability to work directly with Microsoft Office documents, ORM, integration with Sharepoint, and certain features pre-packaged as a service. 
  • LiveCycle ES2 was released.  I’m sure this effects all of 20 people on earth, but this product is just plain awesome.  LiveCycle ES is a workflow management applications (for those of you who only deal with consumer applications, think of the process that your paperwork has to go through when you hire somebody new.  You have multiple interviews, background checks, etc. that all belong in a workflow.  This allows you to manage that process, and make sure nothing is missed).  With it, a bunch of new Flex components have been released that allow you to integrate your applications with these workflows.  Yet another important part of this suite is the “LiveCycle Collaboration Suite,” formerly known as Cocomo.  This suite allows you to make your own interactive / collaboration services.
  • Mobile Devices.  So, there was lots of fanfare about Adobe’s push to make mobile devices 1st class citizens in the computing landscape.  21 of the top 22 device manufactures have signed on with Adobe including RIM, Symbian, Google, Microsoft, etc.  The only one that is missing is Apple, of course, but Adobe didn’t waste time shooting a warning shot over their bow. Adobe announced that in CS5, they expect to be able to publish full-fledged iPhone/iPod Touch applications that can be published on the iTunes store.  This does not mean that the Flash Player will be available for the iPhone, but simply that you can publish applications that were created in Flash/Flex/Catalyst.

A few things that were not released, but were talked about:

  • Flash Builder 4 - This looks like it was delayed until Q1 of next year.  It’s a shame, because a lot of the Adobe tooling is based on it now (interesting thought), so many of those applications have to wait too.  This included some ES2 apps, etc.  Adobe did release Beta 2 to allow people to refresh their builds, and play with things a bit more.
  • ColdFusion Builder – This also looks like it was delayed until Q1 of next year.  It is a LOT closer than people have been anticipating, and, personally I really like it. They have really done a lot of research on the workflow model, and I think they will win over a lot of developers who have been using Allaire ColdFusion Builder, Dreamweaver and all the other products.
  • Codename Stratus – This project allows users to build truly P2P applications with the Flash Player or AIR.  It allows IP Multicast or some sort of “home” server to point copies of FP together an allow them to communicate without the use of a server.  This saves bandwidth for the server, and makes the experience better if the users are geographically near by. The shear thought of being able to use IP Multicast in FP is a huge win for me.  This will require FP 10.1.
  • LiveCycle Data Services 3 – It is coming, and very soon.  This brings a whole slew of new features to the LCDS package that will make huge data applications faster and will allow data to flow better.  One of the coolest things about LCDS3 is the data modeler.  It brings the features of a UML designer, and allows you to both deploy databases via your model, or to build the skels of your applications via the model!  This, to me, is one of the coolest things I saw at the show.  How much was an LCDS server again?
  • Adobe Connect for Mobile – So, this one blew me away, but only a peep was said at the conference. During the Day 1 keynote, they showed the iPhone, among other devices using a mobile version of Adobe connect to join meetings!  This, to me, is one of the features that has the potential to keep Adobe Connect ahead of all the other web conferencing suites out there.  They said that we can expect the iPhone, RIM, Android and Microsoft connect clients to come out “soon”. 
  • Flash Player 10.1 – Lots of neat stuff coming in this one.  FP 10.1 will be smaller, meaner, and mobile ready.  It will feature lots of stuff like the Stratus support, and hopefully will make my bed and pour me a beer.  Make sure to check out the online sessions on this one :)

I also had the chance to catch up with a lot of the evangelists, and talk shop with a lot of the people I usually only communicate with online.  It was great to see everybody, oh, and yeah, I went to a lot of sessions and labs too.  I’m hoping to go through all my notes from the action-packed week from my labs and get cracking on some new apps I have floating in my head (yes, I was inspired).

Follow

Get every new post delivered to your Inbox.

Join 29 other followers