Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
lijomon
Posts: 21
Registered: ‎01-11-2010
My Device: 8310
My Carrier: BlackBerry

writting to device event log with Blackberry widgets - OS 5.0

hi,

 

we are trying to write string to device event log using EventLogger class. we are doing development in VS2008 using BB widgets. following are Code details in .js file

 

EventLogger.register(BB_CTS, 0x97c9f5f6441d25e5f, EventLogger.VIEWER_STRING);
var logMessage = "Test Event Entry.";
EventLogger.setMinimumLEvel(EventLogger.INFORMATION);
EventLogger.logEvent(0x97c9f5f6441d25e5f, logMessage.getBytes(),level );

 

The error is - referenceerror; EventLogger is not defined.

 

Please guide on this with some sample link or code.

Thanks in advance.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: writting to device event log with Blackberry widgets - OS 5.0

Hi lijomon,

 

is the "EventLogger" class a JavaScript extension that you have written in Java?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
lijomon
Posts: 21
Registered: ‎01-11-2010
My Device: 8310
My Carrier: BlackBerry

Re: writting to device event log with Blackberry widgets - OS 5.0

[ Edited ]

Thanks Tim.

We have not written any separate class in Java. We want to use EventLogger class from net.rim.device.api.system.EventLogger.

Please refer to URL http://www.blackberry.com/developers/docs/4.3.0api/net/rim/device/api/system/EventLogger.html

 

Currently we have added access to following features (in config.xml)

 1. blackberry.system

 2. blackberry.app.event

3. blackberry.identity

4. blackberry.identity.phone

 

To use the API do I need to add access to any new feature or is there any other way for acessing above mentioned EventLogger Class.

 

 Thanks in advance.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: writting to device event log with Blackberry widgets - OS 5.0

Hi lijomon,

 

In a BlackBerry Widget you are not able to call Java APIs directly from JavaScript.  The APIs that you can use without modification are the Widget APIs listed here:

http://www.blackberry.com/developers/docs/widgetapi/

 

If you wish to be able to call a specific Java API that we do not yet provide in our JavaScript API, you can can create a JavaScript extension to wrap any Java API so that it can be called in your widget.  A Lab showing how to do this can be found here:

http://na.blackberry.com/eng/developers/devbetasoftware/Lab_Widget_Extension.zip

 

Does that make sense?  There were lots of Java and JavaScript references in the above sentence :smileyhappy:

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
lijomon
Posts: 21
Registered: ‎01-11-2010
My Device: 8310
My Carrier: BlackBerry

Re: writting to device event log with Blackberry widgets - OS 5.0

[ Edited ]

Hi Tim, Thanks a lot, the URL's are very helpful.

 

We want to call a REST webservice, the service needs authentication. Currently we are calling a the web service inside ASPX page, using XMLHttpRequest object and setting the authentication values. We are calling this ASPX page inside a HTML page in the blackberry widget project. This all is working fine.

 Is this a efficient way of calling a Rest webservice in BB widget. or is there any other solution.?

 

 Is it possible call REST webservice Using Gears HttpRequest object?

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: writting to device event log with Blackberry widgets - OS 5.0

Hi lijomon,

 

Using XHR to call your restful web service is a good way to go about it.  You can then decide on what is the best result to return from the web service (i.e. XML or JSON)

 

Both XML and JSON have their pros and cons, but for many forms of data JSON is much more efficient.  You can then use a JOSN parser to do a JSON.parse() on the XHR.responseText instead of using the eval() which has some security concerns

 

Cheers,

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
lijomon
Posts: 21
Registered: ‎01-11-2010
My Device: 8310
My Carrier: BlackBerry

Re: writting to device event log with Blackberry widgets - OS 5.0

Hi Tim, With reference to the pdf document in Lab_Widget_Extension.zip, we executed all the steps. All the Java classes, BB widget and BBWidget settings in confix.xml file are same as in example. Java extension is created in Eclipse, WidgetConfigImpl.java is opened in Eclipse and saved. (i think this will built the file also). We complied the application and try to load .cod file in simulator 9500. its displaying message "Resource Does not Exist" without displaying alert button. Please let us know how to proceed further.
Please use plain text.
Developer
jmace
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

Re: writting to device event log with Blackberry widgets - OS 5.0

"Resource does not exists" in my experience refers to something missing in your config.xml. I would double check what resources you are using to make sure.

_________________________________________
www.jasonmace.com/blackberry
Please use plain text.
Developer
lijomon
Posts: 21
Registered: ‎01-11-2010
My Device: 8310
My Carrier: BlackBerry

Re: writting to device event log with Blackberry widgets - OS 5.0

Thanks .. We fixed the issue, its working now .

 

Please use plain text.
New Member
Srikanth92
Posts: 1
Registered: ‎01-18-2011
My Device: Not Specified
My Carrier: Developer

Re: writting to device event log with Blackberry widgets - OS 5.0

Hi !

 

    Can u give sample code for calling rest web services from blackberry application in Eclipse

 

          Thank   you

Please use plain text.