We are writing a blackberry applciation which has social media integration, we are able to invoke the browser using BrowserSession and call the facebook link with the sharer link http://m.facebook.com/?sharer= , this works perfectly fine , however we have encountered a new method where we could embed the HTML page inside the application screen using Browserfield , unfortunately this library is available only post 5.0
I have some links which indicate that we may be able to use pre-processing directive to detect the version and build the library accordingly , to be specific
ifdef version_5.0_and_above
/* Use BrowserField */
else
/Invoke Browser/
Can someone shed some light on how this can be achieved?
Thanks for all the help in advance
This RIM doc explains how to use preprocessing.
Basically you'll have to create 2 projects with almost the same code. The difference is just in the code that implements your browser actions. For one project you assign a label (preprocessing statement) "OS_5_OR_ABOVE" and use the API 5+, the other project may be left unlabeled (since there are only 2 projects) and it should use API 4.7.0 (or the lowest API your app supports).
A sample code with preprocessing would be:
Definitelly you'll need to compile each project using different JDE (for instance, JDE 5.0 and JDE 4.7.0).
Note you can also use preprocessing for conditional imports. However I'd not recommend this, since it is very easy to break the code in Eclipse on code auto-format/cleanup action.