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: About

Taxi app

1853 days ago

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

Current Projects, Mobile

Comment

---

Window Phone Coding

1892 days ago

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

Mobile, Random

Comment

---

CreaBros Oy

3244 days ago

We host and develop services for small and large business. At the moment we have about ten different companies using our hosted applications and few hundred people use them daily.

Basic services include:


  • Email
  • Web hosting
  • Groupware services

Advanced services include:


  • Online rights / license management for custom software.
  • Online ground transport reservation system for flight crews

Custom software development e.g.:


  • NAF function implemented using PHP for 3GPP GAA standards.

Kalle Kuismanen

About Us,

---