Posts

Where Am I source code

Image
Feel free to take this source away for your learning in webOS. function WAIAssistant() { /* * Author : Peter Wong * Website : petkatan.blogspot.com */ } WAIAssistant.prototype.setup = function() { // Set orientation if (this.controller.stageController.setWindowOrientation) { this.controller.stageController.setWindowOrientation("free") }; // Setup Spinner while getting a GPS fix and set to false until got a GPS fix this.controller.setupWidget("divSpinner", { spinnerSize : "large" }, { spinning : true }); // Latitude and Longitude (set to read-only) this.attributes = { maxLength : 20 }; this.model = {'txtLatitudeModel' : '', disabled: true }; this.controller.setupWidget("txtLatitude", this.attributes, this.model); this.attributes = { maxLength : 20 }; this.model = {'txtLongitudeModel' : '', disabled: true }; this.controller.setupWidget("txtLongitude", this.attributes, this.

Added new feature - Shake to Clear values (reset)

Image
After submitting the app, I have decided to add 1 minor feature - shake it to clear values. You can get this beta app from HP webOS App Catalog. Codes: WAIAssistant.prototype.clearValues = function(){ // Clear all the values this.controller.get('txtLatitude').mojo.setValue (''); this.controller.get('txtLongitude').mojo.setValue (''); this.controller.get('txtMobile').mojo.setValue (''); } WAIAssistant.prototype.handleShaking = function(event) { this.clearValues(); } WAIAssistant.prototype.activate = function(event) { this.controller.listen(document, 'shaking', this.handleShaking.bindAsEventListener(this)); };

Where Am I - SMS your current GPS fix or show it on Google Map

Image
Finally, after couple of weeks learning Javascript and webOS, I have released my 1st app for beta testing. You can download this app from HP webOS Apps Catalog This is free for anyone to use and please do give your feedback on my 1st webOS app.

Send your GPS fix (geolocation) via SMS

Image
Next, I will attempt to send a SMS of the current GPS fix to another phone using Google Map API V2. Unfortunately, this API is already deprecated by Google which I will need to find another way to future proof my app. 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); google_map_url = "http://maps.google.com/?q=" + gps_latitude + "," + gps_longitude; message_text = "Last known GPS fix - " + google_map_url; this.controller.serviceRequest('palm://com.palm.applicationManager', { method: 'launch', parameters: { id: 'com.palm.app.messaging', params: { composeRecipients: [ /*{ address: "the_email_address_you_want_to_send_to", serviceName: "gmail" },*/ { address: mobile_no } ], messageText: message_text } }, onSucces

Launching Google Map after getting a fixed GPS location

Image
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} } } });

Get your current GPS location

Image
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 }); thi

Boot-up time for the new versions of Smartphone

Image
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?