Friday, 29 April 2011

Launching Google Map after getting a fixed GPS location


I will continue with my next part of launching Google Map after getting a GPS fix. Honestly, with so much power given to a developer, doing this is a piece of cake (I guess even easier than baking a cake).
Codes:
gps_latitude = inResponse.latitude;
gps_longitude = inResponse.longitude;
this.controller.get('txtLatitude').mojo.setValue (gps_latitude);
this.controller.get('txtLongitude').mojo.setValue (gps_longitude);

this.controller.serviceRequest("palm://com.palm.applicationManager", {
method: "open",
parameters: {
id: "com.palm.app.maps",
params: {
location: {lat: gps_latitude, lng: gps_longitude}
}
}
});

Wednesday, 27 April 2011

Get your current GPS location

This is a very basic webOS app that shows your current GPS location.

At times, when indoor, the GPS will not give an accurate geolocation, so my suspect that this issue has been embedded in the framework and not the GPS. Perhaps, this is the issue that was reported earlier and was supposedly fixed in webOS 2.0 and webOS 2.1.

This is the value that I am getting and similar to Foursquare, Gowalla, etc.
Latitude = 392.584986 (this is the culprit)
Longitude = 174.865368 (this is correct)



assistant.js:
WAIAssistant.prototype.setup = function() {
/* this function is for setup tasks that have to happen when the scene is first created */
/* use Mojo.View.render to render view templates and add them to the scene, if needed */
/* setup widgets here */
/* add event handlers to listen to events from widgets */

// Set up Spinner for the scrim when getting a GPS fix
this.controller.setupWidget("divSpinner",
{ spinnerSize : "large" }, { spinning : true });

this.controller.setupWidget("txtLatitude",
{ maxLength : 20 }, this.txtLatitudeModel);
this.controller.setupWidget("txtLongitude",
{ maxLength : 20 }, this.txtLongitudeModel);

this.controller.setupWidget("btnWAI", { },
{ label : "Where Am I" } );

Mojo.Event.listen(this.controller.get("btnWAI"),
Mojo.Event.tap, this.wai.bind(this));
};

WAIAssistant.prototype.wai = function() {

$("divScrim").show();
var gps_address, gps_latitude, gps_longitude;

this.controller.serviceRequest("palm://com.palm.location", {
method : "getCurrentPosition",
parameters : {maximumAge : 60},
onSuccess : function(inResponse) {
$("divScrim").hide();
switch (inResponse.errorCode) {
case 0:

gps_latitude = inResponse.latitude;
gps_longitude = inResponse.longitude;
this.controller.get('txtLatitude').mojo.setValue (gps_latitude);
this.controller.get('txtLongitude').mojo.setValue (gps_longitude);

this.controller.serviceRequest("palm://com.palm.applicationManager", {
method: "open",
parameters: {
id: "com.palm.app.maps",
params: {
location: {lat: gps_latitude, lng: gps_longitude}
}
}
});

break;

case 1: case 2: case 3:
Mojo.Controller.errorDialog(
"GPS fix timeout - you will need a clear sky for GPS fix."
);
break;

case 5: case 6:
Mojo.Controller.errorDialog(
"GPS fix cannot be activated - Location Service is off or not accepted the terms of use."
);
break;

case 7: case 8:
Mojo.Controller.errorDialog(
"GPS fix is underway - pending request or temporarily blacklisted."
);
break;
}
}.bind(this),
onFailure : function(inResponse) {
$("divScrim").hide();
switch (inResponse.errorCode) {
case 1: case 2: case 3:
Mojo.Controller.errorDialog(
"GPS fix timeout - you will need a clear sky for GPS fix."
);
break;

case 5: case 6:
Mojo.Controller.errorDialog(
"GPS fix cannot be activated - Location Service is off or not accepted the terms of use."
);
break;

case 7: case 8:
Mojo.Controller.errorDialog(
"GPS fix is underway - pending request or temporarily blacklisted."
);
break;
}
}
});

};

Thursday, 21 April 2011

Boot-up time for the new versions of Smartphone











iPhone has been the cream of all smartphones few years back and I am shock that it has even gain the buying power of uncles and aunties across the world! Perhaps the iOS is quite fluid as compared to other OS.

Bada is pretty new and Samsung is pouring millions into getting developers to develop for them.

Android has been influencing the market with its share of smartphones and sales begin to take off exponentially especially you can get them from eBay.

webOS has been playing a catch-up games and wasted lots of time (2 generations). I am sure with HP taking over Palm, webOS will begin to compete with the rest of the smartphones.

Windows Phone 7 is another new contender and it seems that it is quite fluid in term of UI. Nokia will be putting this OS into their future devices and made Meego obsolete!

With all these smartphones - old and new, what will the new generations of smartphones will bring?

For the time being, what do you think is the average boot-up time for these 1GHz smartphone?
Apple iPhone 4 (iOS 4)

Samsung Wave II (Bada 1.2)

HTC Incredible S (Android 2.2)

Palm Pre 2 (webOS 2.1)

HTC HD7 (Windows Phone 7)

Please do post your boot-up time.

Wednesday, 20 April 2011

Packaging 1st webOS app


This evening, I am trying to package my 2nd round of webOS development as an app. Unfortunately, when I try to follow the step defined by webOS, it didn't work as it says it cannot find the folder!

I will have to figure out how to do this in Debian. Perhaps it is different in Debian as compared to Windows and Mac OS.

While in terminal (root terminal), type the following command to make a build (.ipk) file. Once this is bundled, you can then install this app onto Pre 2.

Usage:
palm-package -o output_folder app_folder_which_consists_of_valid_appinfo.json_file

Command-line:
# palm-package -o /home/peter/workspace/apps /home/peter/workspace/HelloWorld

Once the above command is executed, I got my 1st app in webOS. I can then use my earlier step to SFTP the .ipk file to my Pre 2. Then install the .ipk file through Internalz Pro by Jason Robitaille.

Mission accomplished.

Chris Gin - New Zealand Landscape Photography

Chris Gin - New Zealand Landscape Photography

Saturday, 16 April 2011

Awesome connection to Pre 2 via FileZilla and ssh

With the power of shh and FileZilla, you can remote into your Pre 2 and you can find this in http://forums.precentral.net/palm-pre-tips-information-resources/250011-ftp-access-your-pre-using-filezilla.html Also, I have extracted part of the steps from http://www.webos-internals.org/wiki/Accessing_Linux_Using_Novaterm


The only issue is my installed Terminal is not working on my Pre 2, not sure why though.


I will bypass step 1 and 2 from PreCentral. You will need OpenSSH and Terminal/SDLTerminal before proceeding. This is the only step that is different from others. This is a proven method which I have tried previously.



Step 3:
a. Connect the USB cable to Pre 2, then switch on the Developer mode. Select USB Drivemode so that you can see it in "Root Terminal" of Debian.
b. Go into "Applications" - "Accessories" - "Root Terminal" and you will be at your default folder.
c. Type the following while you are in root and you will see all the folders in webOS.
novaterm
d. You will see your Pre 2 mounted folder as "root@your name - Palm Pre:/#".
e. Then go back to the first link (step 3) to continue with the generation of a key for your Pre 2. Alternatively, you can follow the following steps.
cd /
/opt/bin/ssh-keygen
f. Next , press ENTER to accept default filename. When you are prompted, press ENTER twice to enter a blank password.
g. Next, enter the enter the final commands to transfer your keys to your Pre 2 Media Internal folder:
mv /home/root/.ssh/id_rsa.pub /home/root/o.ssh/authorized_keys
cp /home/root/.ssh/id_rsa /media/internal/media/internal/id_rsa

Step 4:
a. Go back to the first link and follow step 4 onward. You have the option to copy from /media/internal folder.

Now you will be able to see your Pre 2 in FileZilla.








Friday, 15 April 2011

Install PreWare on webOS 2.1 (Palm Pre 2) using Debian

After removing certain apps from my Pre 2, unfortunately, the removal causes instability to my webOS. All the  steps here are taken from those URL highlighted in the steps, therefore all credits go to the creators.

This is what you will need to do in Pre 2 before doing anything:
a. Goto into Developer Mode by typing "webos20090606", select Developer Mode Enabler.
b. When the Developer Mode card is opened, set the switch to "On" and select "Just Charge".

In Debian, do the following
a. Download webOS Quick Install (WebOSQuickInstall-4.04.jar) from http://forums.precentral.net/canuck-coding/274461-webos-quick-install-v4-04-a.html 
b. Download PreWare (org.webosinternals.preware_1.5.0_arm.ipk) from http://get.preware.org/ which is listed in http://www.webos-internals.org/wiki/Application:Preware#Installing_Preware_on_webOS_2.0
c. Select "Applications" - "Accessories" - "Root Terminal" and you will need to enter your password.
d. Once in root, run "palm-install org.webosinternals.preware_1.5.0_arm.ipk" and this will install PreWare on webOS 2.1.


Basically, this is complete and if you want to install other apps through webOS Quick Install, you will need to install webOS Quick Install.
a. Under Debian File Browser, select WebOSQuickInstall-4.04.jar and right-click on it. Then choose "Open with Sun Java 6 Runtime". This will launch the webOS Quick Install.
b. To install, select the "Globe" and it will list all the apps, patches, tweaks, services, etc.

The other alternative is to run PreWare on Pre 2 (once installed). This will list similar stuff as per in webOS Quick Install. Personally, I would prefer to install through PreWare on Pre 2.







Friday, 8 April 2011