Error in JVM access violation reading from 0x00000000 in Blackberry.If the simulator says like this while starting and forcing you to exit then,
1)Go to simulator installed path.For me C:\Program Files\Research In Motion\BlackBerry Smartphone Simulators 4.6.0\4.6.0.259 (8220)
2)Delete all files with .dmp extension.
3)Restart the simulator
Hope works fine...
Tuesday, August 31, 2010
Wednesday, August 25, 2010
current language set on Device ,J2ME
In J2ME ,current language set on the device can be known using a single line code
String locale=System.getProperty("microedition.locale");
List of Languages supported by the device can't be known through J2ME API as per my knowledge.
String locale=System.getProperty("microedition.locale");
List of Languages supported by the device can't be known through J2ME API as per my knowledge.
Monday, August 23, 2010
TimeZones and Timezone offsets in Blackberry and J2me
In J2me , a class called TimeZone is used to determine offset of timezone.
First get all the Ids by
TimeZone class is applicable for both Blackberry and J2ME
From Blackberry 4.6 a new class TimeZoneUtilities is intoduced.
Just use the following code to retrieve array of Timezones
The above code will give the list of important places and their corresponding timezones where as TimeZone class willl give only TimeZones (without city name).
First get all the Ids by
tring ids[]= TimeZone.getAvailableIDs(); for(int i=0;i<0;i++){ // will give you the TimeZone offsets such as +5,-4 etc. TimeZone.getTimeZone(ids[i]).getRawOffset(); } // will return the timeZone offset set in the device. TimeZone.getDefault().getRawOffset();
TimeZone class is applicable for both Blackberry and J2ME
From Blackberry 4.6 a new class TimeZoneUtilities is intoduced.
Just use the following code to retrieve array of Timezones
String str[]=TimeZoneUtilities.getDisplayNames(0);
The above code will give the list of important places and their corresponding timezones where as TimeZone class willl give only TimeZones (without city name).
Gps in J2me,Blackberry
GPS(Global positioning system) can be achieved using Location API which is an optional package for J2ME.Blackberry also uses the same APi for GPS.Location APi(Jsr 179) is provided by nokia.
the code for getting the latitude and longitude is:
Latitude can be retried by qc.getLatitude()
Longitude can be retrieved by qc.getLongitude()
these latitude and longitude can be then provided to google static maps to get relevant maps.
some google urls are
http://maps.google.com/maps/api/staticmap?zoom=14&size=200x200&maptype=roadmap&markers=color:red|label:S|40.714728,-73.998672&sensor=false
The above url will give a static map with pointing marker.
the code for getting the latitude and longitude is:
Criteria c=new Criteria(); c.setHorizontalAccuracy(1000); c.setVerticalAccuracy(1000); c.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW); LocationProvider lp=LocationProvider.getInstance(c); Location loc=lp.getLocation(60); QualifiedCoordinates qc=loc.getQualifiedCoordinates();
Latitude can be retried by qc.getLatitude()
Longitude can be retrieved by qc.getLongitude()
these latitude and longitude can be then provided to google static maps to get relevant maps.
some google urls are
http://maps.google.com/maps/api/staticmap?zoom=14&size=200x200&maptype=roadmap&markers=color:red|label:S|40.714728,-73.998672&sensor=false
The above url will give a static map with pointing marker.
List of languages supported by Blackberry device
In order to know about the list of languages supported by blackberry device use Locale Class .
gives the list of locales in the device.
returns the string,which is the language of that corresponding locale.
see also
Locale supportedLocales[]=Locale.getAvailableLocales()
gives the list of locales in the device.
supportedLocales[i].getLanguage()
returns the string,which is the language of that corresponding locale.
see also
supportedLocales[i].getCountry();
Locale.getDefault();
Connections in Blackberry and DeviceSide
There are 5 different ways to connect to internet using Blackberry.They are
1)BES(Blackberry EnterPrise Server) using MDS(Mobile Data System)
2)BIS(Blackberry Internet Services)
3)Direct TCP/IP
4)WIFI Network
5)WAP(Wireless Application Protocol) Gateway
By using BES we can directly pass url as connection parameter without appending any deviceSide.
(HTTPConnection)Connector.open("http://www.blackberry.com");
While connecting to internet using BES the connection pathway is MDS by default except for some devices(6500,7500).In order to explicitly connect using MDS in all append deviceside=false at the end of the URL.
(HTTPConnection)Connector.open("http://www.blackberry.com;deviceside=false");
From Blackberry 3.8 there is a possibility for direct TCP/IP connection without using MDS.
For Blackberry smartphones operating using IDen networks(developed by Motorolla) a direct TCP connection is established if deviceside is not specified.For Blackberry smart phones doesn't operate on IDen networks Connection is established through MDS if deviceside is not specified.If blackberry MDS is not available during time of connection a direct tcp is established.
To override the default behavior of connection append deviceside=true at the end of url.
(StreamConnection)Connector.open("socket://testserver:600;deviceside=true");
In Wifi connections Blackberry smart phone is directly connected to blackberry infrastructure via WIFI.Blackberry Infrastructure exists between blackberry smart phone and BES or BIS.For the connections through WIFI no special logic is required except appending ;interface=wifi to the required url.
(StreamConnection)Connector.open("socket://testserver:600;interface=wifi");
In WAP connections Connection string parameters are hosted by wireless network provider.
References:
http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-make-an-HTTP-or-socket-connection/ta-p/445879
Complete reference:
http://supportforums.blackberry.com/t5/Java-Development/Connecting-your-BlackBerry-http-and-socket-connections-to-the/td-p/206242
Glance on networks in blackberry:
Some Video tutorials:
http://www.blackberry.com/DevMediaLibrary/view.do?name=NetworkingTransports
http://www.blackberry.com/DevMediaLibrary/view.do?name=NetworkingTransportsII
1)BES(Blackberry EnterPrise Server) using MDS(Mobile Data System)
2)BIS(Blackberry Internet Services)
3)Direct TCP/IP
4)WIFI Network
5)WAP(Wireless Application Protocol) Gateway
By using BES we can directly pass url as connection parameter without appending any deviceSide.
(HTTPConnection)Connector.open("http://www.blackberry.com");
While connecting to internet using BES the connection pathway is MDS by default except for some devices(6500,7500).In order to explicitly connect using MDS in all append deviceside=false at the end of the URL.
(HTTPConnection)Connector.open("http://www.blackberry.com;deviceside=false");
From Blackberry 3.8 there is a possibility for direct TCP/IP connection without using MDS.
For Blackberry smartphones operating using IDen networks(developed by Motorolla) a direct TCP connection is established if deviceside is not specified.For Blackberry smart phones doesn't operate on IDen networks Connection is established through MDS if deviceside is not specified.If blackberry MDS is not available during time of connection a direct tcp is established.
To override the default behavior of connection append deviceside=true at the end of url.
(StreamConnection)Connector.open("socket://testserver:600;deviceside=true");
In Wifi connections Blackberry smart phone is directly connected to blackberry infrastructure via WIFI.Blackberry Infrastructure exists between blackberry smart phone and BES or BIS.For the connections through WIFI no special logic is required except appending ;interface=wifi to the required url.
(StreamConnection)Connector.open("socket://testserver:600;interface=wifi");
In WAP connections Connection string parameters are hosted by wireless network provider.
References:
http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-make-an-HTTP-or-socket-connection/ta-p/445879
Complete reference:
http://supportforums.blackberry.com/t5/Java-Development/Connecting-your-BlackBerry-http-and-socket-connections-to-the/td-p/206242
Glance on networks in blackberry:
Some Video tutorials:
http://www.blackberry.com/DevMediaLibrary/view.do?name=NetworkingTransports
http://www.blackberry.com/DevMediaLibrary/view.do?name=NetworkingTransportsII
Subscribe to:
Posts (Atom)