Mobile App Installer , now for both iOS and Android.

March 8th, 2013 by Slav

Mobile App installer is a quick way to install your application files on usb attached mobile device (simple drag and drop).

This is an updated version of IOS Installed application I blogged about couple of weeks ago.

The biggest change is , this is no longer just to install iOS applications but Android ones as well. There’s a big IOS/ANDROID switch to manualy select the platform.

I did consider automatic platform selection by the type of attached device, but if you do a lot of cross platform development you tend to have both kind of devices attached, so in that case manual selection of target platform is best..

The other big change is, you no longer need to drag the application manifest xml file unto the app. Just the application file : .ipa for iOS and .apk for Android.

I unpack the application file in the memory and find the bundled application manifest and get the app ID information from it..

appInstaller

You can download the installer here.

Any problems / issues /bugs .. leave a comment here..

Posted in AIR, Android, AS3, Mobile | 16 Comments »

Obtaining .p12 certificate for iOS development on Windows. The easy way (WITHOUT prompt and manual OpenSSL installation)

February 24th, 2013 by Slav

Getting into iOS development isn’t exactly straightforward. Even before deploying a simple test app on iOS device you have to get (and pay) apple developer membership fee, and then there’s a whole process of obtaining a developer certificate, generating p12 file and provisioning profile that needs to be bundled with your app in order to test it on device. This process is made slightly easier for users of Macs , since they have a nice keys management tool installed on every mac called Keychain.

On windows though there’s no such tool, and every single guide I came across (including the official one from Adobe) instructed users to install OpenSSL, and then use command prompt and type in paths, names , commands etc.

This was very tedious, slow , user unfriendly and error prone.

Thankfully, there is another way! It’s a OpenSSL based GUI for Windows called XCA: X Certificate and Key Management.

xca

This tools enables you to obtain a personal development certificate, certificate signing request, private or public key encoded with 2048bit RSA encryption, export p12 certificate i.e.  everything you need to do in order to publish a valid .ipa file for iOS device. All with nice drag and drop interface, with easy to manage and access sections, lightweight and organised. Secured and safe as well.

You can download XCA at SourceForge.

Although it would seem that you can do everything on Windows PC, in order to develop iOS app that’s not entirely true. Unfortunately, Apple has made the final step (of uploading the final app for general distribution via iTunes store) available only via mac OS only based software (xCode or appUploader). So you still have to use Mac (mac emulator) for this final step. I’d love to be proven wrong and if anybody knows of other way.. please leave a comment here!

Posted in AIR, Mobile | 16 Comments »

Route directions using geolocation+google maps api on Android 2.2 and Air 2.6

April 3rd, 2011 by Slav

Recently I’ve worked on a mobile app for the company I work for , and instead of just showing company’s address or displaying it on a map I thought.. wouldn’t it be more helpful to give user directions from wherever he is to where the company is ?
To do this, you of course, need to utilise a few APIs:

1. Google Maps API to download map tiles and draw a poly line from user’s location to destination,
2. Air’s Geolocation API to determine current users location
3. Air’s Multitouch API to let the user pan/zoom and rotate the map.

Getting the google maps to show on your display list is pretty straightforward, there’s a couple caveats though. It is now compulsory to initialise map with a sensor parameter (just a Boolean switch expressed in string format indicating whether map is used on a device with geolocating sensor.)
Also , to get it working in AIR app, you have to pass the ‘url’ parameter. I used local host for this.

		private function initMap() : void
		{
			//init map
			map = new Map3D();
	
			map.x = mapsDimensionsBox.x;
			map.y = mapsDimensionsBox.y;
			map.key = apiKey;
			map.url = "http://localhost";
			map.sensor = "true";
			
			
			map.setSize(new Point(mapsDimensionsBox.width, mapsDimensionsBox.height));
			map.addEventListener(MapEvent.MAP_READY, onMapReady);
			map.addEventListener(MapEvent.MAP_PREINITIALIZE, onMapPreinitialize);
			gfx.addChild(map);
		}

Getting user’s location is relatively simple, but it’s best to check first whether user’s device support’s it and whether it has been turned on :

	private function getGeolocation() : void
	{
		if (Geolocation.isSupported)
	         {
	            geo = new Geolocation();
	         	if (geo.muted)
	         	{
	         		alert("Please turn on the location or select a manual address input",showManualLocation);
	         	}
	         	else
	         	{
	            	geo.setRequestedUpdateInterval(100);
	            	geo.addEventListener(GeolocationEvent.UPDATE, geolocationUpdateHandler);
	         	}
	         }
	         else
	         {
	         	alert("Geolocation not supported, please input your location manualy", showManualLocation);
	         }
	}

Once we have the GeolocationEvent fired , we can determine user’s location from event.latitude and event.longitude.
However, Google maps Directions.load normally works with address format query, eg. “from 25 apple Street, NewYork to 22 Boulevard Street, San Francisco”. To get it working with LatLng you have to use this format (Thanks to Barry Hunter from Google maps forums for this tip)

private function geolocationUpdateHandler(event : GeolocationEvent) : void
{
	originLatLong = new LatLng(event.latitude, event.longitude);
	dirQuery =  "from: Start@"+originLatLong.lat()+","+originLatLong.lng()+" to: Destination@"+fbfLatLong.lat()+","+fbfLatLong.lng();
	initMap();	
}

(fbfLatLong being hardcoded LatLng destination variable)

After the geolocation is known and direction query is formulater we can get directions by calling load function:

private function requestDirections() : void
{
	//create directions
	dir = new Directions();
       dir.addEventListener(DirectionsEvent.DIRECTIONS_SUCCESS, onDirLoad);
       dir.addEventListener(DirectionsEvent.DIRECTIONS_FAILURE, onDirFail);
     
       dir.load(dirQuery);
}

Once the requested directions are computed and returned we can draw the route. I am also attaching a custom markers at the start and the end of the journey.

 
private function onDirLoad(event : DirectionsEvent) : void
{
	map.clearOverlays();

	var directions : Directions = Directions(event.directions);
	var startLatLng:LatLng=directions.getRoute(0).getStep(0).latLng;
	var endLatLng:LatLng=directions.getRoute(directions.numRoutes-1).endLatLng;
	
	createMarkers(startLatLng,true);
	createMarkers(endLatLng,false);
	
	var directionsPolyline:IPolyline = directions.createPolyline();
	map.addOverlay(directionsPolyline);			
	
	//get bound center
	var directionsBounds : LatLngBounds = directionsPolyline.getLatLngBounds();
	map.setCenter(directionsBounds.getCenter());
	
	//get the zoom level from direction bounds
	var zoomLevel:Number = map.getBoundsZoomLevel(directionsBounds); 
	map.setZoom(zoomLevel);
	map.setAttitude(map.getAttitude());
}		

It’s important to centre and zoom the map so that the whole journey is visible on the map.
OnDirFail is called when the given coordinates couldn’t be resolved, and then it’s probably best option to give user a chance to input the address manually.
Tested on Android 2.2 on Desire HD with Air 2.6 runtime.

Posted in AIR, Android, AS3, flash, Mobile | 15 Comments »