Deprecated: Function set_magic_quotes_runtime() is deprecated in /home2/creabros/public_html/creabros.fi/textpattern/lib/txplib_db.php on line 14
CreaBros Oy - Mobile Helping With Computer Stuff tag:www.creabros.fi,2005:26a712242462e138d6e14fdd1c6b9152/mobile Textpattern 2013-04-13T11:09:13Z Kalle Kuismanen kalle@creabros.fi http://www.creabros.fi/ Kalle Kuismanen 2012-11-19T00:54:41Z 2012-11-19T01:33:02Z Taxi app tag:www.creabros.fi,2012-11-18:26a712242462e138d6e14fdd1c6b9152/4ab1cc748aa4ee374c7b54fa575600ff Just finished a cross platform Taxi App. There is a big taxi company in Finland called Lähitaksi and they have nice textmessage based ordering system. I pitched about two years ago, that I could make them a geolocation based cross platform app to help users so that they don’t have to type in long road names. Application was published by Fairspectrum.

Platforms were Windows Phone, Android, iOS and Symbian. I decided to use PhoneGap or Cordova

Coding the original application took about two days. Goal was to use Cordova wrapper and quickly adapt the Javascript to different platforms.

Initially all went very well. All platforms except Symbian had Cordova implementation. Original estimation that it would take two days / platform to do the adaptation was quite close. Main problem was that our original design didn’t work quite seamlessly across the different platforms and had to be tuned a bit.

Then we ran into problems. We had hoped to use Openlayers and Open Streetmap for mapping and Nominatim for reverse geocoding. Unfortunately Open Streetmaps in Helsinki region weren’t quite upto date and we had to adapt. So for iOS we used Mapkit, for Symbian and Android Google maps and for Windows Bing maps. This increased work load about ten fold. First problem was that it was first time we were coding a “real” app for Windows so little bit of studying was needed. Our Javascript codebase needed some branching. On iPhone and Windows Phone we used the native map widget, but on Symbian and Android Openlayers.

Biggest problem was Windows Phone. Cordova fought back the whole way home, but finally we succeeded. Main problem was, that when we wanted to send events to the Javascript from C# code, the events arrived multiple times. We ran out of time and just redesigned the code to ignore multiple events.

Cordova project doesn’t include Symbian wrapper so we had to use QWebView to do it. It worked out very nicely though Symbian Web Runtime was also a viable alternative. Main problem was the poor quality of Symbian tools. We couldn’t debug on the device – phone rebooted when debugger connected etc. But application works really well.

Beautiful graphical design was created by Mainostuli

Android version: Google Play
iOS version: iTunes
Windows Phone: Window Phone Store
Symbian Version: Submission pending

]]>
Kalle Kuismanen 2012-11-16T02:38:36Z 2012-11-25T16:24:57Z Stackoverflow answers / we salute you tag:www.creabros.fi,2012-11-15:26a712242462e138d6e14fdd1c6b9152/a5a4643c18f6931d83f5264e55883a12 Best things are done by people for people just because. One of the best examples of this is the http://stackoverflow.com questions.

I’ve been stuck many times and found salvation from this website! I salute you all.

I decided that I should also make a contribution so here it is…

How to make dialogs in phonegap

Here is my solution

]]>
Kalle Kuismanen 2012-10-11T01:22:24Z 2012-10-11T01:22:24Z Window Phone Coding tag:www.creabros.fi,2012-10-10:26a712242462e138d6e14fdd1c6b9152/8010bd9235b0d86f1d20644b729faba3 I’ve been coding using Cordova to create a cross platform app for ordering Taxis. I’m currently porting to WP7. This was the first time I coded for Microsofts Silverlight. It is funny how difficult simple tasks can become when you don’t know your way around the basics.

Problem was rather simple. Two classes the MainPage and a custom Plugin needed to communicate. Reason for this was that I had to add a native map and native buttons, because my Openlayer based solution didn’t give a nice user experience.

Adding the map and buttons to xaml file were easy, but how can I communicate with the map and buttons from my plugin? As an after thought it was quite easy, but it took a long time to figure it out.

So two classes MainPage and MyPlugin. MainPage had three buttons, which raised click events. These events needed to be relayed to the Javascript functions. Javascript needed to attach buttons to specific functions after it loaded.

It turned out that nothing needed to be done for the MainPage, but it took some figuring out.

Implementation

Steps were:

  1. find control from the xaml.
  2. manipulate or attach event handler to the control
  3. listen to events from control

First problem how to find the control? After many tries and reading documentation it become obvious that the way to go was to access the App instance and work my way current ApplicationPage. Then use FindName to find the control I wanted to manipulate or listen. Easy enough.

var mypage = App.Current.RootVisual.Content; – wrong
var button = mypage.FindName("mybutton") as System.Windows.Controls.Button; – ok

problems

  1. App is not defined – fix: namespace of the App needed to be used
  2. Need to do some casting to get my page
  3. At run time I get exeption, because UI is in different thread than the Plugin

fixes

so to get mypage
var mypage = ((PhoneApplicationFrame)MyApp.App.Current.RootVisual).Content as MyApp.MainPage;

next line:
var button = mypage.FindName("mybutton") as System.Windows.Controls.Button;

is ok. But there is a big problem. At run time there is the exception mentioned earlier. We can’t call the methods on MainPage directly. To by pass this we need to use Dispatcher, which will invoke the call in the correct thread.

Call becomes
Deployment.Current.Dispatcher.BeginInvoke(() => {
var mypage = ((PhoneApplicationFrame)MyApp.App.Current.RootVisual).Content as MyApp.MainPage;
var button = mypage.FindName("mybutton") as System.Windows.Controls.Button;
button.Click += new RoutedEventHandler(this.fireEvent);
});

or we can use a delegate

add a member to our plugin

public delegate void ButtonEventDelegate(string str);

Now it is possible do the previous bit more neatly

Deployment.Current.Dispatcher.BeginInvoke(new ButtonEventDelegate(HandleButtonClick), argument_array);

HandleButtonClick is simple function that executes same stuff that is inside brackets in the first BeginInvoke command.

fireEvent function needs to be something like this
public void fireEvent(object sender, EventArgs e)
{
var button = sender as System.Windows.Controls.Button;
// sending message to Cordova i.e. Javascript
string[] strs = new string[1];
strs[0] = button.Name;
var args = new ScriptCallback("testFunction",strs);
InvokeCustomScript(args)
}

And that is pretty much all there is to it.

]]>
Kalle Kuismanen 2012-10-07T00:39:37Z 2012-10-07T00:52:19Z Web Apps to the rescue? tag:www.creabros.fi,2012-10-06:26a712242462e138d6e14fdd1c6b9152/f028a8c852540fe1221aa7ea1123e09e I’ve been coding a little application (unfortunately current version has problems in iOS6, new version is being approved) , which you can use to order a taxi in Helsinki metropolitan area. Original idea was to make everything with PhoneGap i.e. in javascript and port it to all mobile phones.

Application is a simple map that can be clicked to indicate your location and it will fetch the address using reverse geocoding. Taxi is then ordered using a SMS. It took me two days to code. All good.

But then problems arrived. OSM didn’t have accurate enough information for the taxis. What to do. Well for iPhone I decided to use the native MapKit i.e. Google maps. So had to dive into Native code. Extra week of time. In WP7 phone OpenLayers were too slow. Native code again. I’m not an expert in Silverlight so four days learning, two days coding. Still have Android and maybe Symbian … don’t even want to think about it – not at least until Monday.

Lesson here? Each phone platform is a island at the moment. Will someone bring a nice cross platform C++ library to rule them all?

]]>
Kalle Kuismanen 2011-09-24T21:40:59Z 2012-02-13T12:18:07Z Stopwatch sales triple while Box of Dice Sales Double tag:www.creabros.fi,2011-09-24:26a712242462e138d6e14fdd1c6b9152/ab5732c24613cddf0ce46bb73a8d2e95 In August we did a bit of promoting of our Ovi Store, now Nokia Store, applications for Symbian^1, Symbian^3, Anna and Belle Touchy Feely Stopwatch and A Box of Dice 3D. We also added translations and made a few upgrades to the applications and launched Decision Dice. It seems that our actions had a significant effect and we’ve clearly sold more in the month of September than we’ve sold at any time in the history of our apps, with the exception of the first month when Ovi Store opened and the stopwatch app was first launched. The best part is we became less dependent on our sales to Finland. There are a lot of Nokia phones in Finland, but it is still a fairly limited market. See Images below.

Sales distribution
Distribution of sales to top 10 countries for Touchy Feely Stopwatch August 2011

Sales distribution
Distribution of sales to top 10 countries for Touchy Feely Stopwatch September 2011

A surprise came from Norway and Denmark. Markets that we hardly knew existed jumped into the top three. France has previously been a relatively big market, but had for some reason declined, but now re-emerged into top three. Merci beaucoup! Mange Tak! Tusen Takk!.

For the Box of Dice 3D we’ve been puzzled at the sales. They have been very concentrated in Thailand. When we first released the game there were over twenty thousand free downloads from Thailand, so perhaps it is a class room favourite there? We really don’t know but ‡∏LJ∏≠‡∏ö‡∏ч∏∏‡∏ì‡∏°‡∏≤‡∏Å to our customers in Thailand. Hopefully you enjoy the dice. Unfortunately we don’t have a Thai friend (yet) who could translate the comments. Google translations don’t really make sense.

Here are our sales distributions for “A Box of Dice 3D”

Sales for
August sales of “A Box of Dice 3D” app for all countries

Sales for
September sales of “A Box of Dice 3D” app for all countries

So we only sold to six countries in August, with almost all sales going to Thailand. In September we sold to eleven countries, but most of the sales still went to Thailand.

Our disappointing sales of the Decision Dice prompted us to give it away for free in order to spread the word, but though it has quite nice graphics and physics simulation it got buried in the avalanche of entertainment applications.

All in all it has been a very satisfactory September. We could still use more revenue from the apps so we could quit our day jobs, but it is nice to see strong upward trends, despite the platform we are using being squeezed. Perhaps the new Belle operating system and new devices will boost the Symbian base.

]]>