Posted by jason on Mar 2, 2010 in
Windows Mobile
Previously, I wrote about signing cab files for Windows Mobile 6. The application was initially created for Windows Mobile 5 Pocket PC devices. We got it working on Windows Mobile 6 Pocket PC.
Recently, I was tasked with creating an installer application to get around some of the browser inconsistencies they’ve been experiencing with the various Smart Phones. They have an installer app that has an executable and an XML file that the executable reads for it’s configuration. Pocket PC allows you to download the XML file and the executable file and everything just worked. The Smart Phones do not behave this way. I created an app that downloads both the EXE and the XML file to the My Documents directory and launches the EXE. Works great.
My problems started when I tried to cab up the whole thing and install it from a mobile device. I signed each file inside the cab as well as the cab itself. I kept getting prompted by the device asking me if I want to trust this unknown publisher? At first, I thought maybe I had screwed up the signing. Turns out that no, I did sign it correctly… for windows clients. The Windows Mobile platform uses a different technology than Authenticode.
On this MSDN article about how to Sign your Windows Mobile Application, it states very clearly: ”Authenticode signatures for other Windows platforms, such as Windows Client or Windows Server, use a different technology than Windows Mobile code signing and are not recognized as valid normal or privileged mode signatures.” What I don’t yet understand is that it states Windows Mobile (not Smart Phone) uses a different technology, yet we used Authenticode to make the prompts go away for the Pocket PCs we were testing on (Windows Mobile 5 and 6).
The Windows Mobile code signing seems very expensive. From what I can tell it costs $350 for 10 signings. There is an additional fee for each signing after that. What this means is that you better be darn sure your application is finished before signing your application. I’ve read that you have to submit your signed cab to Verisign who then signs your cab file with their certificate. I am beginning to hate the Windows Mobile platform and might actively root for their demise…
Posted by jason on Feb 13, 2010 in
iPhone
The iPhone has some really cool features for web apps.
One feature that I particularly like is called Web Clips. These are pages that can be installed on your home screen. You can specify an icon for use on the home page just like you would for a native app. If you don’t supply one, then it uses a screen capture of your page. You can also supply a splash screen png that will display while your web page is loading. You can hide the address bar to make it look even more like a native app. There is one small gotcha with this though. If you click on any link inside your webpage, it will open up Safari and close your nice page. The trick then is to make the entire application a one page app. You accomplish this through the use of AJAX.
Another feature that is very cool is new to HTML 5. You can specify a cache manifest file that tells the iPhone which files to cache locally. The cool thing about this is that if you have an application that is static, you can run the app while the iPhone is in airplane mode. This is very cool. You can even specify fallback files that are used when the app is offline. When I tested this out, the application was VERY snappy. Currently only Firefox 3 and Safari 4 support this.
A final feature that I have not explored very much is client side storage. This is also a new HTML 5 feature. All the newest browsers except Chrome support this feature. This is a necessary feature if you want to have some sort of database driven offline capable application for the mobile device.
Posted by jason on Feb 5, 2010 in
Windows Mobile
I ran into Smart Phone not supporting another control. It doesn’t support button controls. The Smart Phone has a menu at the bottom that behaves as a button.
I seem to have troubles finding this article when I need it, so here is a link to help me figure out the user interface options I have for the SmartPhone:
http://msdn.microsoft.com/en-us/library/aa446513.aspx#smartphoneuserinterface_topic3
Posted by jason on Dec 20, 2009 in
Mobile Devices,
Windows Mobile
I recently encountered an issue where a Windows Mobile 5 application I wrote wasn’t working on a Windows Mobile 6 smart phone. This particular phone was in Spain so I was not able to hold it in my hands.
Initially I believed it was because I didn’t have the Windows Mobile 6 SDK installed. I needed the app to be backward compatible to Windows Mobile 5 so I haven’t messed around with the new SDK yet. When I looked (skimmed) through the documentation, everything led me to believe that most windows mobile 5 apps will run on a Windows Mobile 6 device. There is the exception that if you are using undocumented APIs, they aren’t guaranteed to work. Since the app I’m working on logs GPS coordinates in the background, it was possible that I was using some calls through a 3rd party library.
Turns out my problem was much more basic. Once I got my hands on an actual Windows Mobile 5 smart device to test on, I discovered the problem right away. The app was failing when it tried to create a list box. My simplistic thinking was that you write applications for “Windows Mobile 5″. You actually write for either Windows Mobile Smartphones or Windows Mobile Pocket PCs. One is more limited than the other. The naming is still confusing to me. My iPhone is a “smart phone” so I assumed that Smartphone was simply Pocket PC + phone. WRONG. Windows Mobile 6 makes it even worse. They label one sdk “standard” and the other “professional”. I am pretty sure professional = pocket pc = more functionality.
So I learned that if you want to write lowest common denominator applications for Windows Mobile, you need to target the smart phone. And you should really test your interface at different resolutions because those smart phones have tiny screens.
Posted by jason on Nov 9, 2009 in
BlackBerry
Programming for the blackberry can be frustrating. It seems that they have taken every useful function I’ve used in the past and thought “is there a harder way to do this already?” If the answer was yes, they ripped out the function. The latest example I’ve uncovered while developing is simply adding time and dates to arrive at some time in the future. I am trying to add a number of seconds to an existing timestamp. In standard Java, there is a handy add function that does this for you. Unfortunately, in Java ME, they have ripped it out. To get that functionality back, you need to understand when you call getTime() on a date, it returns the number of milliseconds since January 1, 1970, 00:00:00 GMT as a long. The value “1″ represents one millisecond. So, to add one day to your date, you simply need to determine how many milliseconds in one day and add that to the value returned by getTime().
int milliseconds = 1 * 1000 * 60 * 60 * 24; // 1 day * 1000 milliseconds/second * 60 seconds/minute * 60 minutes/hour * 24 hours/day
Date newDate = new Date(myDate.getTime() + milliseconds);
This will add one day to your date.
Posted by jason on Oct 6, 2009 in
BlackBerry
Seems like it is rather complex to make a simple HTTP request on BlackBerry. The code for opening a connection is straightforward:
String url = "http://10.0.0.1";
HttpConnection conn = conn = (HttpConnection)Connector.open(url);
The complexity comes in because I am developing on a BlackBerry device without service. When I try to execute the above code, I get an IOException stating “Tunnel failed”. From searching, it appears that I get this message because APN is not set. I can not set it because I do not have service for this phone. If you don’t have the APN set, it does not automatically try and use the WIFI connection. Apparently there are six different methods for using a connection. Each one of these requires a different string appended to the URL to determine which one gets used.
BlackBerry MDS
The first method is using BlackBerry MDS. This forces all traffic to go through the BlackBerry enterprise server. It encrypts all traffic using AES or Triple DES. My task is to specifically avoid using the MDS because we are creating a cloud service where the customer does not need to have any server let alone a BlackBerry enterprise server.
String url = "http://10.0.0.1;deviceside=false";
BlackBerry Internet Service
The second method is to use the BlackBerry Internet Service. This is only available to approved BlackBerry Alliance Program members. There are different tiers. The public tier which is free does not offer the BlackBerry Internet service feature. The minimum tier that supports this is the BlackBerry Alliance Associate Member which costs $2,000/yr and requires 45 member points. To get this, you basically have to make losts of money using the BlackBerry platform or promot it in other ways. You can look at their FAQ for more details, but basically we don’t have this option available to me right now.
TCP Stack
The third method is to use the TCP stack directly. In order to use this, you need to have the APN username and password.
String url = "http://10.0.0.1;deviceside=true";
Wi-Fi
The fourth method is to use wi-fi. This is what I’m interested in right now.
String url = "http://10.0.0.1;interface=wifi";
WAP 1.x
The fifth method is to use WAP 1.x gateway. This is supported over the carriers networks. You have to contact the carriers to get a list of their WAP gateway parameters.
String url = "http://10.0.0.1;WAPGatewayIP=127.0.0.1;WAPGatewayAPN=carrier.com.gprs";
WAP 2.0
The sixth way is to use WAP 2.0. You need to loop through the records and find the uid of the desired ServiceRecord in the ServiceBook. This is simpler than WAP 1.x because you don’t need all the gateways and settings from the carriers. This is supported as of 4.2 on the BlackBerry.
// String uid = get from the device
String url = "http://10.0.0.1;ConnectionUID=" + uid;
Going Forward
I would really like the device to try wi-fi first before attempting to use the potentially expensive data plan. I am going to have to write some code to test the wi-fi first, and then attempt the data connection if this fails. It is conceivable that the user wouldn’t want the app to transmit unless the wi-fi connection is available. Not as simple as just opening up a connection and firing off a GET request.
Posted by jason on Oct 5, 2009 in
BlackBerry
Blackberry applications are written in Java. Since the java mantra is write once, test everywhere. er. sorry, run everywhere. You would think that you could choose whatever OS you would like to develop for the Blackberry. While the documentation claims you can write Blackberry code on any platform, the reality for a new developer is quite different. The Eclipse plugin they offer only runs on Windows. Very irritating considering I can run eclipse on my Mac as well as my Windows machine. Rather than fight it, I am going with the flow and using Windows XP 32bit inside my Parallels virtual machine.
Very important that you pay attention to the version of eclipse that the plugin works with. I didn’t and installed the lastest eclipse (3.5 as I write this). I went to “Help > install new software…” using “http://www.blackberry.com/go/eclipseUpdate”. I got the following error:
Cannot complete the install because one or more required items could not be found.
Software being installed: BlackBerry JDE Plug-in for Eclipse 1.0.0.67 (net.rim.EclipseJDE.feature.group 1.0.0.67)
Missing requirement: BlackBerry JDE Plug-in for Eclipse 1.0.0.67 (net.rim.EclipseJDE.feature.group 1.0.0.67)
requires 'org.eclipse.debug.ui [3.4.0,3.5.0)' but it could not be found
I had to download the gannymede 3.4.2 version of eclipse and install it. Then I did the software update using the http://www.blackberry.com/go/eclipseUpdate URL. It prompted me half a dozen times for my Blackberry Developer zone ID. I dutifully entered it each time (annoying). After this, I had a working environment.
In the BlackBerry JDE Plug-in for Eclipse Installation and Configuration demo video, They show configuring the BlackBerry workspace. Well, this option is not enabled until you created a BlackBerry project. Also in this video, you will see them run the simulator just by clicking run. This did not work for me. In order to actually launch the application in the simulator, you need to right click the project and select “Activate for Blackberry”. If you don’t do this, Eclipse will launch the simulator and you will see debug output, but your project will not show up on the device.
The next step is to get it working on an actual BlackBerry device. When I first attempted this, it would not work with my old version of parallels. I updated to the latest build of parallels and then Windows could recognize the USB device. My mac took control and parallels did not prompt me like it usually does when I connect a USB device. There is an icon in the lower right of the frame. Click the USB icon there and select “Research in Motion”
I haven’t been able to get the Eclipse IDE to install and run the application on my device. I’ve had to use the tool JavaLoader.exe which is located in the bin directory of your JDE installation.
JavaLoader.exe -usb load HelloWorld.jad
JavaLoader.exe -usb erase -f HelloWorld.jad
These commands will install and remove your application. This assumes that the bin directory is in your path and you are in the location where your *.jad and *.cod file.
Posted by admin on Sep 22, 2009 in
BlackBerry
Well, I am in the middle of learning to write my first blackberry application. Since Blackberry uses the Java platform so heavily, I was excited to be able to develop natively on the Mac. Apparently there is no easy way to actually do this. I am used to using Eclipse for my java development so I was excited that Blackberry had an Eclipse plugin. I was very disappointed to learn that this plugin only works on a Windows machine. I believe it is the Simulators that cause the problem. I didn’t want to spend days fighting this issue, so I gave up and installed Eclipse on a Windows 32bit virtual machine. I was quite bummed to have to do this. I don’t understand why they go to so much trouble implementing the JME which is platform neutral, and then totally bomb when it comes to forcing developers to develop on a Windows box. I think it is crucial for them to support more than Windows so they can attract the thousands of iPhone developers that love their Macs (like me). Or maybe they know that if you really want to develop for the blackberry, you will just install Windows. I am looking forward to some Android development…
Posted by admin on Aug 23, 2009 in
C++,
iPhone
I am trying to import an X3d file into my iPhone application. I could use the NSXMLParser to do this, but I want to write as much of the application logic in C++ as possible. The reason I want to do this is that I would like to be able to port this application to a different platform in the future. NSXMLParser is only usable from Objective C. the iPhone has the libxml2 installed . This is an xml parsing library with a generous license (MIT).
In order to use it, you will need to add the library to your project. I created a “libraries” folder and right clicked it. Select “Add > Existing Frameworks”. Navigate to /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libxml2.2.dylib.
You then need to add the following include directive in the file you want to use it:
#include <libxml/parser.h>
You need to add the library to your project search path. Open project properties. On the build tab, find “Search Paths” > “Header Search Paths”. Add “/usr/include/libxml2″ to this path. You should be able to compile and use libxml2 now.
Posted by jason on Aug 22, 2009 in
Objective-C,
iPhone
I am currently going through some tutorials for the SIO2 game engine I am currently evaluating. I was able to run the code just fine on my iPhone simulator. When I went to deploy this tutorial to my iPhone device, I got a “Code Sign error: The identity ‘iPhone Developer: Romain Marucchi-Foino (VC824XU999)’ doesn’t match any valid certificate/private key pair in the default keychain”.
To fix this so I could deploy, I clicked “Project > Edit Project Settings”. I changed the Code Signing Identity to point to my cert. I got the same error. I searched the file system to try and figure out where that string was coming from. In Visual Studio, sometimes I have to edit the project file with a text editor to fix weird issues like that. So, I opened up the *.xcodeproj file to see if I could find it there. I use TextMate for my Ruby code so I fired it up to open that and it turns out that *.xcodeproj is not a file but a package or directory or whatever Mac fanboys call it. Inside I found the project file and found the string. I wanted to figure out how to fix this through the UI so I didn’t just change the text there. I did notice though that the old cert was listed under a different profile.
So, back in the project properties, I selected “All Settings” in the configuration drop down and changed the cert once again to my cert and everything worked!
UPDATE: Well, It happened to me again but this time, changing the code signing cert didn’t help. I had to go into the actual project file by right/command clicking on myproject.xcodeproj and selecting “Show Package Contents”. Edit project.pbxproj with a text editor. Search for: “CODE_SIGN_IDENTITY[sdk=iphoneos*]” = “iPhone Developer: Romain Marucchi-Foino (VC824XU999)”; Replace all of these with your own identity. for me it was: CODE_SIGN_IDENTITY = “iPhone Developer: Jason Rowland (2RK77WERHG)”; Save the file, and go back to xcode. It will prompt you to reload from disk and say yes. Maybe another day I’ll figure out where the setting is in the GUI but now that I know I can change these things with a text editor, I probably never will