Samsung Galaxy S3 killer feature: Smart Stay!

I’ve been playing around with an SGS3 for a couple weeks now, and I must admit that I’m pretty impressed with this device.

I’m one of those early android adopters that bought an HTC Hero and I’ve been using it for around 4.5 years. I know that it has really old hardware and it’s many Android versions older than this SGS3 device, but I was using it primarily as a phone (making calls/SMS) and as an application tester, so it worked well and had good battery life.

I’m not going to do here a device review (because I’m sure that you can find a lot of those), and I’m just going to point out what for me is this device killer feature:

 

 

 

Smart Stay!

When you have a screen as big as this, you don’t scroll pages as often as you would on a device with a smaller one. Without this feature, I believe that it would be really annoying having to touch the screen every 30s just so it wouldn’t go to sleep.

I believe that Samsung got it right, and I believe that this feature should be in all tablet devices too!

BlackBerry Webworks Facebook Post

Facebook integration with an Webworks app, can be a really tricky matter. If you ever tried this you’ve noticed that the Facebook JavaScript SDK, don’t work in the widget and also that the Facebook BlackBerry SDK, is intended for JDE project and also don’t work on a Webworks project.

The best thing that I’ve found in the web that partially solved this, was to use ChildBrowser-plugin-for-BlackBerry, that maybe it used to work, but since some new modifications in the Facebook API, it doesn’t work anymore…

Actually with the ChildBrowser-plugin-for-BlackBerry, I was able to login and retrieve the token using the Torch 9800 simulator, but it just didn’t work for the Bold( device or simulator), so I needed to dive more deeply into it.

I’ve notice this plugin used a BrowserField to connect to Facebook and that it make no sense that it worked on the Torch simulator and not on Bold.

On the Bold device, when I tried to login, it just refreshed the page and didn’t login adding some Security notice.

Since the login worked on any other desktop browser, I’ve opened a sniffer and looked at how was the communication between the browser and Facebook.

Then I’ve also debugged the webworks app and noticed that the only difference between them were that the BlackBerry app was sending an x-wap-profile and maybe this was the reason why Facebook was rejecting the communication.

To be able to set those headers, I needed to create my own ProtocolController, and by doing this I could trick Facebook to think that actually it was a Desktop browser trying to connect. I’ve also had to implement the ability to store and send cookies, and after doing that I was able to connect to Facebook and actually retrieve the token.

Since I used the ChildBrowser-plugin-for-BlackBerry, I think that it’s only fair that I also share my progress, and so you can download it from here BlackBerry-Webworks-Facebook-Post

 

Best regards,

Daniel Botelho

BlackBerry Webworks Javascript Extension to allow File Downloads

If you are a BlackBerry Webworks developer I’m sure you’re always noticing that something is missing.
This time, I took some time to develop something that is really trivial in other plataforms, but due to Webworks nature, it’s bit triky.

My goal was simple: Download an image to the device, and show it in the Webworks app.
So as usual I googled it, and found that are at least one solution for the BlackBerry PlayBook, but not for OS5+.

Since I think that this is useful, I’ve decided to create an Javascript Extension to do this, and you can now download it here

The installation process is as usual, just download that file to your “ext” folder, and make it accessible to the application by adding it to the “config.xml”:

<feature id="blackberry.io.filetransfer" required="false" version="1.0.0"/>

To be able to access those downloaded files through the widget you may need to also add this line to the “config.xml” file:

<access subdomains="false" uri="file:///"/>

With this Javascript Ext you’ll have only one method available:

blackberry.io.filetransfer.download(arguments);

And the “arguments” can be:

  • url (required): Is the download url. ex: “https://www.google.com/images/srpr/logo3w.png”
  • dest (required): Is the local file location. ex:”file:///store/home/user/logo/logo.png”
  • type (optional): Can be ‘POST’ or ‘GET’ (default: ‘GET’)
  • success (optional): Is a Javascript function that is called after the download is complete
  • error(optional): Is a Javascript function that is called if the download fails for some reason
  • headers (optional): For this version the headers only allows you to set the “Authorization” and/or “Content-Type”, but if you need more support please let me know.

And now I’m leaving two examples of how it really works:
Example 1: Download the google logo and notify when it’s done

<script language=”javascript” type=”text/javascript”>

// Here whe need to create the local folder, if it doesn’t exist already
if (!blackberry.io.dir.exists(“file:///store/home/user/logos/”)) {
blackberry.io.dir
.createNewDir(“file:///store/home/user/logos/”);
}

// Download the file
blackberry.io.filetransfer.download({
url: “https://www.google.com/images/srpr/logo3w.png“, // the image url
type : ‘GET’, // explicitly setting method type to ‘GET’
dest: “file:///store/home/user/logos/GoogleLogo.png”, // the local file
success : function(data){ // The function called after the file is downloaded
alert(‘success’);
},
error : function(data){ // The function called if something fails
alert(‘error:’+data);
}
})
</script>

Example 2: Download the google logo with HTTP Basic Authentication

<script language=”javascript” type=”text/javascript”>
function make_base_auth(user, password) {
var tok = user + ‘:’ + pass;
var hash = Base64.encode(tok);
return “Basic ” + hash;
}

// Here whe need to create the local folder, if it doesn’t exist already
if (!blackberry.io.dir.exists(“file:///store/home/user/logos/”)) {
blackberry.io.dir
.createNewDir(“file:///store/home/user/logos/”);
}

// Download the file
blackberry.io.filetransfer.download({
url: “https://www.google.com/images/srpr/logo3w.png“, // the image url
type : ‘GET’, // explicitly setting method type to ‘GET’
headers:{
Authorization: make_base_auth(“my_username”,”my_password”),
“Content-Type”: “application/x-www-form-urlencoded”
},
dest: “file:///store/home/user/logos/GoogleLogo.png”, // the local file
success : function(data){ // The function called after the file is downloaded
alert(‘success’);
},
error : function(data){ // The function called if something fails
alert(‘error:’+data);
}
})
</script>

You can find the source code here https://github.com/dbotelho/blackberry.io.filetransfer

J2ME References

Hi,

So I’ve started developing for J2ME devices and I’ve noticed that there aren’t many information around, so I’ve decided to start bookmarking some useful links.

J2ME LCDUI

Image Manipulation

Books

http://book.javanb.com/wireless-java-developing-with-j2me/

Blackberry Javascript Extension using an external library

I have a BlackBerry WebWorks project that needed to use Omniture reporting. Since Omniture already have an library for BlackBerry, I’ve decided to create an JavaScript Ext that would expose that functionality to the web application.

The only thing that you need to do differently from creating another regular JS Ext is that you need to include a new “<dependencies>” tag in the library.xml file, with the relative location of the external library.
Here it’s the example:

<library>
  <extension>
   <entryClass>xxx</entryClass>
  </extension>
  <features>
   <feature id="xxx" version="1.0.0" >XXX</feature>
  </features>
  <dependencies>
   <jar path="omni.jar" />
  </dependencies>
 </library>

Android Simulator/Emulator: Delete directory

One thing maybe (or maybe not) you’ve noticed is that you can’t delete an entire directory using DDMS on eclipse.

To be able to delete a directory on simulator sd card you can use the ADB command and connect to device via shell.

The first thing to do, is to go to “<android-sdk-PATH>/platform-tools” and from there type:

./adb devices

Then connect via shell to the device that you want:

./adb -s emulator-5554 shell

Now you’ve connected to the device “emulator-5554″  and now you can remove the files or directories that you want!

Android fixed Status Bar is just BAD

I’m an ASUS eee Pad Transformer proudly owner, and even though I still didn’t receive the most promised ICS update for my Transformer, I’m already a bit disappointed at Google Design decision to maintaining it fixed bottom Status Bar.
The Honeycoumb was the first version of Android that was really intended for tablets and the idee of removing all the hardware buttons and use only software ones looked really the best way to go.

I’m an ASUS Transformer proudly owner, and even though I still didn’t receive the most promised ICS update for my Transformer (is due to March), I’m already a bit disappointed at Google Design decision to maintain its fixed bottom Status Bar.

The Honeycomb was the first Android version for tablets and the idea of removing all the hardware buttons and use only software buttons looked really the best way to go but  now with almost a year of using it, I start to realize it’s disadvantages.

First it will reduce the available screen height and second it’s prone to miss touching on those buttons when what you really want is to tap on some button that is on the bottom of the application.

This limitation is already addressed in this issue http://code.google.com/p/android/issues/detail?id=15408 but it’s marked as WorkingAsIntended. If you are one of us that think that this is a huge design limitation, please express your thoughts in there!

Blackberry Widget dialog and menu conflict issue for OS 6.x

If you have developed a Blackberry Widget app that uses features blackberry.ui.menu and blackberry.ui.dialog in the same application, you’ve noticed that your application won’t work on devices that have OS version 6.x (like the Torch 9800 -6.0.0.227).

To fix this I’ve developed an Javascript Widget Extension that actually does the same as blackberry.ui.dialog but that uses another namespace( to avoid conflict with blackberry.ui.menu).

To use this Widget you should do this:

  • Download the blackberry.ui.dialoger and put this file in projects directory “ext”;
  • Go to applications “config.xml” and replace “blackberry.ui.dialog” for “blackberry.ui.dialoger”
  • Then replace all occurrences of  “blackberry.ui.dialog” for “blackberry.ui.dialoger” in your widget source code
  • And it’s Done!

Now your application can run in both OS 5.x and OS 6.x, and supports dialogs and menu items!

Best regards,

Daniel Botelho

Blackberry Widget with Google Analytics

This is another weird thing! Actually I’ve tried to use Asynchronous Snippet but soon I realise that it didn’t work properly in the widget since it would only track the pageView for the first time the widget loaded.

So I’ve decided to use the same code that I use in this website, and everything works!

To track a pageView I use this code:

pageTracker._trackPageview(‘<page_name>’);

To track an event I use this:

pageTracker._trackEvent(‘<category>’, ‘action’, ‘label’);

If you still can’t use Google Analytics in your BB Widget is because maybe you forgot to add :

<access subdomains=”true” uri=”http://www.google-analytics.com”/>
<access subdomains=”true” uri=”https://ssl.google-analytics.com”/>

to your widget permissions!

Running J2ME applications and midlets on Android is possible?

This port is merely a proof-of-concept that running J2ME applications and midlets on Android is possible. The builds are far from complete and deploying all the components (phoneME VM + Android frontend wrapper + JNI bindings) on your device is not trivial. Have a look at some of the screenshots. Here are a few of the main issues that had to be resolved.

Haven’t tested it yet, but checkout this: http://davy.preuveneers.be/phoneme/?q=node/28