Category Archives: Android

10 tips and tricks for Phonegap Developers

0
Filed under Android, HTML5, PhoneGap, iPhone/iPod touch, mobile

While working with Phonegap, You might figure out to what use after your first hello World demo, like listing files, loading, effects, transitions and you might consider using some framework to avoid all those boilerplate of DIY the UI. Problem is some of the framework still needs adjustments and if you don’t understand whole framework you might end up messing around until you find out best solution.

But if your project needs a bunch of implementation and you’re with time to do so, and kind of control what you want and doing it in the right time, here’s my tips and tricks to avoid snagging and became lazy on producing some valuable apps.

1 – Never use JQuery library for your Next Phonegap App. It’s a hell of a job make things work, specially for loading content, the side effect is you’re using chuncks of code for IE, Opera, Safari and a bunch of other __prototype__ you don’t need it at all.

My suggestion is use ZeptoJS. Tiny, fast and ultra lightweight lib, and you just load what you need, targeting webkit child-browser. The syntax is very similar to jQuery and works like a charm, supporting even gestures out of the box.

2 – Never use file:/// to load local files in your Phonegap Apps, instead, use $.ajax(), better transverse XMLHttpRequest then loading files directly into DOM without pitfalls of loading.
And when doing so, disable async, otherwise browser will pimp or flicker specially if you’re in iOS.
Other thing to mention is the access Origin, if you’re just like me, use * for all website to request.

3 – Use as much as possible @media queries, there’s a bunch of tutorials and materials out there who can teach you exactly your needs. This is a very good point for multi-device density. And never forget to use images by screen dpi as well, otherwise your App is floated with dpis not used.

4 – For Android Developers, always clear the content of your App first then delete the App from the device, before you generate another version to your device, PhoneGap always cache the content of loaded files and you will be failing if you’re trying to fix some bugs on meantime.

5 – Use only the device capabilities you need it, Specially if you’re in Android and by default the ./create methods enables everything by default, you might be scary your user if all available capabilities are in use.

6 – Test your code in Chrome, Since uses the lastest webkit approach, you will need it to emulate your content and test media queries.

7 – Continuing with the testing code approach, Forget about Emulators when you’re designing the UI, you don’t need them for creating UI and workflow. You just need to fire up a Emulator when you need to test device capabilities like Camera, Mic. Even if you need GPS you Chrome serves very well those things.

8 – DRY (Don’t Repeat Yourself), Use AngularJS for the databinding, very usefull for Mobile developers. But if you’re a good MVC fan, BackboneJS is there for it.

9 – For Blackberry developers, use their own API for Media, PhoneGap API for Media is slow on BB6 devices, works awesome on BB7, specially playing local files.

10 – For iOS developers, Keep in mind for big density, so do a very well elaborate images for those devices, otherwise the Apple’s team will reject your app if graphics are poor. “Trust me, they will”.

Midnight Coders set on fire , let’s begin 2012 with right foot.

0
Filed under Android, Flex, WebOrb

Here’s the last message from Midnight Coders guys, they have awesome news to 2012.

Here’s our New Year’s present from Midnight Coders: We just released version 4.5 of WebORB for Java and WebORB for .NET with a bunch of enterprise class features. We have worked long and hard to make it happen and it feels great to make the releases available for you right before the New Years! Here’s what we put into 4.5:

- WebSocket support for JavaScript-based messaging applications relying on publish/subscribe messaging model. We also provide a JS library for making it ultra simple to build JavaScript pub/sub apps.
- Our Data Management framework has been updates to support multi-schema databases. The data management code generator can produce server-side code in Java/C#/Vb and client-side code in JavaScript or ActionScript.
- Conditional message delivery in Publish/Subscribe messaging support by WebORB. All supported messaging clients (JavaScript with polling, JavaScript with Web Sockets, native Android, Flex/AIR, Flash, Silverlight, native Java and .NET) can create messaging Consumer with selectors expressed as SQL-92 queries. This applies to internal WebORB messaging as well as integration with MSMQ, NMS and JMS.
- We added Heroku to the list of cloud-based deployments supported by WebORB for Java. The complete list now includes Heroku, EC2 and Google App Engine.
- Data Management offline mode support for Flex/AIR clients. This applies to both desktop and mobile clients.
- Updated Flash Builder plugin to support the latest release of Adobe Flash Builder (4.5 or above).
- Bug fixes. You can see a complete list of all addressed bugs at:
WebORB for .NET: http://dev.themidnightcoders.com:8080/secure/IssueNavigator.jspa?mode=hide&requestId=10210
WebORB for Java: http://dev.themidnightcoders.com:8080/secure/IssueNavigator.jspa?mode=hide&requestId=10211

Download your copy and let us know what you think!

Happy New Year Everyone!

Go get it! Kudos to all Midnight coders team and Mark.

The 3 secrets recipes to get a successful Mobile App

2
Filed under Android, iPhone/iPod touch, mobile

I’ve been working lately for the last 2 years on Mobile development for ios, android and now on Playbook. Most of my 19 mobile apps done are rarely download by others because most are enterprise level others are on brands control which contracts can’t blame, but some are really success because brands name.

Anyway, after those year and getting so much fun on mobile development and also by user perspective, it’s quite simple to get success with your app. You just need to follow the great samples out there, take the best characteristics of those examples and start doing yours.

Let’s make it simple, imagine 3 main categories, you will don’t need much more than that to get success.

1 – The dumbest as possible

In real world we are Simpsons, no matter how much you want to argue with me, we all are dumb, it’s kind part of human race.

Take this example of app http://t.co/uj1IGQW1 How 50k ~ 100k download a success app like that?

Plucking hair? Awesome idea, I mean as thinking as dev I’m proud of developer’s who did that and you know many people download because they want
to spend time between a flight or waiting for coffee on Starbucks.

The secret for this category is to make the dumbest app as possible, don’t re-invent the wheel, we have many dumb behavior just translate that to an App and you will get a impact on 1mi or 2 mi people. Do you have an iphone? Then you remember iFart don’t you?

2- The Funniest to all ages

If you have a device where you want to interact with it, what you human think firstly? Games! That’s it, no big deal, just that.

That’s the first thinking when you think funny. And an App in this category should be Dumb like this app or Awesome like those on video.

Or even better, genial idea with funniest as possible like this.

When doing apps on this category the secret are: Make them awesome, full of rich graphics, funny sounds, when possible interact with our daily life, that should works on parties, wedding, even playing with the cops or political figures. The funniest as possible the better it will be.

3 – Just simple as that

When you interact with your mobile Apps, how much hands do you use? Regularly 1, isn’t? That’s the point. Ordinary people are must making check-in in places, twitting, chatting, sms, typing and finally talking, those things we use with only one hand, why should your App on smartphone need to use two of ours? Isn’t odd this behavior to apply on your Mobile app? On Tablet is plausible to use it , because we read magazines, e-mail better, play more awesome games but on smartphone doesn’t make any sense to me to use both hands to interact with an app, you just need one and your attention on where you’re. Don’t even challenge me if you never tweet on driving.

If your app just want to use one hand only, make it simple, don’t add all garbage stuff we have on laptops, pc, because there has too much space for it, more processing power, more memory power and better one, more fast internet connection.

Smartphones are new market, why don’t make this market simple, elegant and functional. The future in this category is to look back in 90’s; Where we have simple functions, features on our PC. 3 Features are great one for your web start-up.

If you think to put all features you have in a web version of your app, why did you make the web version anyway? Its has to be done to be smooth integration, PC and Laptops are going to have long life 8 or 10 years. Or do you consider developing code and debuging on a phone ? Tablet? Maybe, but not now.

The secret to this category is to make functional, simple and 3 features only, that’s all we need on mobile App for smartphone, like this one.

Voice, 1 finger type and hold and that’s it, it’s functional and just work. That’s 100k and 500k download the app. Because it’s easy to interact with it.

Almost 60 years ago a crazy one told us “This simple thought made a deep impression on me” Who told that?

Ah! don’t forget all apps should be social, don’t sell expensive more than U$1.99.

Be successful my readers.

What’s new on Flex 4.6

1
Filed under Android, Flex, Flex Mobile

flexmobiles
For sure you’re probably working right now on next killer Flex mobile apps to hit Apple Store, Android Market or Blackberry App world. But you may not knowing or maybe loosing some great news that Flex team is working right now on next Flex 4.6 SDK.

By far or even shorter time it’s a very sustainable build for Flex mobile development with 50% gain performance, and they’re not lie, it really fast, kind of building native sensitive app, or close to that with the very intuitive way of custom interface that only on Flash platform you can have with easy tasks.

Check out this beautiful article wrote by Jacob describing those new features that you will face and apply for a pre-release program to start testing the new SDK and also some other features that I might not be able to talk over here due to NDA.

Detect Connection on Flex or AS3 Mobile Apps

1
Filed under 3.0, AIR, Actionscript, Android, Flex, Flex Mobile

This is a small screen cast where I demo how to develop and how to solve the problem of dealing with connection, if you’re game developer and want save local score or on-line score, or even if you’re enterprise developer who are whiling to save off-line data for sales apps.

Hope you enjoy, and sorry for noise sound!

AIR 2.7 release – now on Android move AIR to SD //Woot

0
Filed under AIR, Android, Mobile Handsets

This is one of my yelling since AIR was introduced to Android phones, And it just took almost 1 year to do that. But better late than never.

Now dudes, you may have AIR moved to SD and free 17mb of your internal memory and likely you have more phone space to kick ass performance.

Check out the latest release notes from the trenches.

I’m really excited with this new release, and not only with the ability to move to SD but also the speed improvement even on Android(3x) and iOS (4x)

Check out what’s new here.

Also check out the AIR Blog team post.

Hacking Google maps to work on your Flex 4.5 /AIR mobile project

26
Filed under AIR, Android, Flash Builder, Flex, Flex Hacks, Flex Mobile

Recently I was building Flash Camp Brazil android version of app to attendees, and we came across a problem, using Google Maps on AIR mobile development. Since, theses days many developers are facing the problem, I’d like to demo and show you how to deal with that, even with other solutions around there.

Likely, I was authorize to open-source the application to the crowd, and many folks mailed us regarding Google Maps on air mobile project, they was in need help to solve a better propose and how to really work with Google Maps without facing 15 up to 30 seconds wait time. You of course don’t want your user waits this time to use your maps or app.

According to the official issue, Google uses SHA-1 encoding to locale somethings on the maps even collections of some sort of map data, which impacts in small devices with limited resources, since the .swc provided by Google Maps Team, is out of date and still uses Flex 3 architecture and component life cycle is hard to use on Mobile, since they are updated to Flex 4.5.

This particular problem isn’t only related to Flex problem actually is a problem on the .swc provided, which keeps you waits much longer than you expect. Since there’s no signal of update or fix, we have workarounds, that drive us for better safe and palliative solution for particular problem.

Google Maps is always update to Javascript developers, since is the main target for Google and of course they have this right, why not use those most recent release of js inside our project, it will of course help us a lot. The current version of Maps for Javascript developers in this time of blog post is V3, which is highly performance for Desktop and Mobile devices, Whooahhh!

Google always keep Javascript version update, and we can use that on our mobile Project. This way we can put in practice Adobe AIR StageWebView class in use and take advantage of using it with air mobile project.

Dealing with StageWebView is a little tricky because you have to remove it if you’re not in the current Screen and intend to remove it to show other view.

With your Flash Builder open, create a new Flex Mobile Project.
01-flexhack

I created two views, first one is just to push to the Maps View where resides my StageWebView class, and where I will deal with it. But if you’re new to Flex Mobile here’s the source code of each view.

First View

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
		xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
 
	<fx:Script>
		<![CDATA[
			protected function button1_clickHandler(event:MouseEvent):void
			{
				navigator.pushView(MapView);				
			}
		]]>
	</fx:Script>
 
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:layout>
		<s:VerticalLayout paddingLeft="10" paddingRight="10" paddingTop="40"/>
	</s:layout>
	<s:Button label="Show my map" click="button1_clickHandler(event)"/>
</s:View>

MapView (Second View)

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
		xmlns:s="library://ns.adobe.com/flex/spark" viewDeactivate="removeStageWebViewHandler(event)" title="MapView" viewActivate="view1_viewActivateHandler(event)">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>
	<fx:Script>
		<![CDATA[
			import mx.events.FlexEvent;
 
			import spark.events.ViewNavigatorEvent;
 
 
			private var myWebView:StageWebView;
 
 
			/**
			 * @protected 
			 * Just add and set site of my StageWebView 
			 * */
			protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
			{
				 myWebView = new StageWebView();
				 myWebView.stage = this.stage;
				 myWebView.loadURL("http://maps.google.com");
				 myWebView.viewPort = new Rectangle(0,70,stage.stageWidth,stage.stageHeight-150);
			}
 
 
			/** 
			 * @private
			 *  
			 * Just override to re-scale due to auto-orientation project nature
			 * */
			override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
 
 
				if (myWebView) {
					var point:Point = localToGlobal(new Point());
					myWebView.viewPort = new Rectangle(point.x, point.y, unscaledWidth, unscaledHeight);
				}
			}	
 
			protected function goBackHandler(event:MouseEvent):void
			{
 
				navigator.popToFirstView();
 
			}
 
			protected function removeStageWebViewHandler(event:ViewNavigatorEvent):void
			{
				myWebView.stage = null;
				// just remove the target and will leave.
 
			}
 
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:navigationContent>
		<s:Button label="Go Back" click="goBackHandler(event)"/>
	</s:navigationContent>
 
</s:View>

Great, by now you’re enabled to see the device showing the Google Maps optimize V3 map. And you hacked the Google Maps for Flash and used a better solution, but we have a serious problem, this just show you how to show the map, but if you want from a for example click on a item and show in the map that address. How to deal with that, Yeah! just use url parameters.

I can configure whatever I want in Google Maps V3 just by URL, when you search on “maps.google.com” directly on your browser you assume that hidden google Maps pass some parameters and those can be seen by clicking it at Link.

Well, I will use this URL “http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=”+ city + “&z=12&sensor=true”, to the demo, since “city” is a String property that I’ve created, I will pass throw navigator.pushToView to be setted, since my StageWebView is setted when the view is activate I will no need to worry about that.

Again, here’s my first view, with little list of special cities.

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
		xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
 
	<fx:Script>
		<![CDATA[
			protected function button1_clickHandler(event:MouseEvent):void
			{
				navigator.pushView(MapView);				
			}
 
			protected function list1_clickHandler(event:MouseEvent):void
			{
				navigator.pushView(MapView,mycities.selectedItem);
			}
 
		]]>
	</fx:Script>
 
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:layout>
		<s:VerticalLayout paddingLeft="10" paddingRight="10" paddingTop="40"/>
	</s:layout>
	<s:actionContent>
		<s:Button label="Show my map" click="button1_clickHandler(event)"/>
	</s:actionContent>
	<s:Label fontSize="29" fontWeight="bold" text="Or select a city bellow:"/>
	<s:List id="mycities" width="100%" click="list1_clickHandler(event)">
			<s:dataProvider>
				<s:ArrayList>
						<fx:String>San Francisco,CA</fx:String>
						<fx:String>Petrolina,PE Brazil</fx:String>
						<fx:String>London,UK</fx:String>
						<fx:String>France,FR</fx:String>
				</s:ArrayList>
			</s:dataProvider>
	</s:List>
</s:View>

And my Map View (second view)

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
		xmlns:s="library://ns.adobe.com/flex/spark" viewDeactivate="removeStageWebViewHandler(event)" title="MapView" viewActivate="view1_viewActivateHandler(event)">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>
	<fx:Script>
		<![CDATA[
			import mx.events.FlexEvent;
 
			import spark.events.ViewNavigatorEvent;
 
 
			private var myWebView:StageWebView;
			private var city:String;
 
			/**
			 * @protected 
			 * Just add and set site of my StageWebView 
			 * */
 
			protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
			{
 
				// set the city with data default property of each view
 
				city = data.toString();
 
				 myWebView = new StageWebView();
				 myWebView.stage = this.stage;
				// myWebView.loadURL("http://maps.google.com"); // default
				 myWebView.loadURL("http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q="+ city + "&z=12&sensor=true");
 
				 myWebView.viewPort = new Rectangle(0,70,stage.stageWidth,stage.stageHeight);
			}
 
 
			/** 
			 * @private
			 *  
			 * Just override to re-scale due to auto-orientation project nature
			 * */
			override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
 
 
				if (myWebView) {
					var point:Point = localToGlobal(new Point());
					myWebView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);
				}
			}	
			override protected function stateChanged(oldState:String, newState:String, recursive:Boolean):void
			{
 
			}
 
			protected function goBackHandler(event:MouseEvent):void
			{
 
				navigator.popToFirstView();
 
			}
 
			protected function removeStageWebViewHandler(event:ViewNavigatorEvent):void
			{
				myWebView.stage = null;
				// just remove the target and will leave.
 
			}
 
 
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:navigationContent>
		<s:Button label="Go Back" click="goBackHandler(event)"/>
	</s:navigationContent>
 
</s:View>

Awesome, I no need to worry about setting Lat, Long, don’t need to get my location or any kind of trick, just use URL parameter and my StageWebView, couldn’t be simple isn’t.

Here’s some screenshots of the app.
flexhackfirstview
flexhacksecondivew

Good luck with your other projects. There’s always other ways like local files with markers, because via URL Google doesn’t provide that.

Open source Flex Mobile app for Flash Camps worldwide

1
Filed under AIR, Android, Flash Builder, Flex, Flex Mobile, Open Source Stuffs

During FlashCamp Brasil RIACycle where I’m CTO was in charge of doing the Android version for the event.
Was quick tough because we had very little time to do, to be honest we just had 2 days to create the app, test, deploy and publish. But we did it Oo-arh!!!

Before you go throw download link, keep in mind that this project was done with latest available version of Flex 4.5 SDK release, isn’t available to download right now, but Adobe soon will release it. If you try with Flash Burrito it won’t work.

So, our challenge begun with who was in charge of doing such thing in so little time. Lapsed some hours planning, actually 2 hours planing of what we could include or not, than rest time was spend on coding efforts.

Our second challenge was to choose the available frameworks on the market, decisions on what type to create, web or native or third-party vendor. Currently there are plenty of options for Android devices, which is cool because you have to choose which is the best one.

Coding with Flex framework for mobile devices is pretty simple as you’re self-used to desktop or web apps, the only concern we have to deal is against memory consumption, screen resolution, re-use of Views (which is tricky) and finally the persistence.

Project was deployed successfully in the Android Market, but we decide as contest suggest to open source the app to worldwide, soon as you get your code, you’re able to work on your version for other flash camps worldwide.

I’m really excited with other apps based on our work and really looking forward new endeavors.

Check out the source code here. Be sure to read the GPL V3 license.

Creating in less than 30 min Flash 10.1 mobile content for Android 2.2

1
Filed under Android, Experiments, Fireworks, Flash, Flash 10.1 Mobile, Flash Player, Mobile Handsets

This afternoon I had 2 hours free to test out my new brand Google Nexus One, first step was to update to froyo build, which is auto in Nexus One, than I installed the Flash Player 10.1 for mobile device across the Google Android Market, pretty smooth, all went well.

Than, to make sure everyone else, designers, developers, newbie, should try out as I did, I tried to not make any previous example to record the video bellow, I wanted to test as go, no cuts, no edition on the video, just push the record button and playing it.

The requirements you should have are: Flash CS5 installed, Adobe Device Central CS5, Fireworks CS5 (I can’t play with photoshop, don’t know it).

The result is bellow, a very simple and easy to do flash application runing on Nexus One Browser.

Creating in less than 30 min Flash 10.1 mobile content for Android 2.2

Hope you enjoy as I did.
Ps( Sorry for audio quality or some bad spell words in english, sometimes when you don’t practicies you always talk like a dumb!).