Best Windows Hosting

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, 29 August 2012

Phonegap on Blackberry: 2 Programming Tips

Posted on 23:12 by Unknown

I am creating an application using phonegap which will run on blackberry, android and iPhone. For now, I am just trying to run it on blackberry. I found two things important which I thought I must share. Maybe someone can give me better idea and more tips!!

1. Add type and order of the transport methods to be used by blackberry device in the config file.

<rim:connection timeout="25000">
<id>TCP_WIFI</id>
<id>BIS-B</id>
<id>TCP_CELLULAR</id>
<id>MDS</id>
<id>WAP2</id>
<id>WAP</id>
</rim:connection>   

Find detailed article on Blackberry Page

2. Always use deviceready event listener to check connection on the blackberry device

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() 
{
   checkConnection();
}

function checkConnection() 
{
var networkState = navigator.network.connection.type;
var states = {};
states[Connection.UNKNOWN]  = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI]     = 'WiFi connection';
states[Connection.CELL_2G]  = 'Cell 2G connection';
states[Connection.CELL_3G]  = 'Cell 3G connection';
states[Connection.CELL_4G]  = 'Cell 4G connection';
states[Connection.NONE]     = 'No network connection';
if(states[networkState]=="No network connection")
{
alert("No Connection Available");
navigator.app.exitApp();
}        
}

Find detailed article on Phonegap Page

Note: While running your code on web browser, you need to comment the above code as deviceready event listener is meant only for device not web browser. It may throw a javascript error while running on web browser.
Email ThisBlogThis!Share to XShare to Facebook
Posted in Phonegap | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • DOM Events: Mouse Events, Keyboard Events, Form Events, Frame Events and Touch Events
    Mouse Events 1. Click Event (onclick): The event occurs when the user clicks on an element. 2. Double Click Event ( ondblclick):  The event...
  • Protecting E-mail Addresses on Webpages: Beware of using mailto protocol
    Placing an e-mail address on a Web page is a dangerous prospect nowadays. If the document on which the address appears generates even a medi...
  • Relation between Tablespace, Datafile and Control File
    Databases, tablespaces, and datafiles are closely related, but they have important differences: An Oracle database consists of one or more l...
  • Hash Collision Attacks in .NET
    Hash collision attacks attempt to populate a hash-table within a server application with large numbers of items whose keys resolve to the sa...
  • What is DOM (Document Object Model): Tree and Node Structure of HTML Page
    The Document Object Model (DOM) defines a standard way for accessing and manipulating HTML documents. The DOM presents an HTML document as a...
  • Frameset, Frame and IFrame Elements in HTML
    Frame Element With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and...
  • Window Object in Javascript: Properties and Methods
    1 The Window object is the top level object and represents the window of the browser. 2. Window objects are either the current window (if th...
  • Response.Redirect vs Server.Transfer: What to use when? An 11 point comparision
    1. Response.Redirect simply sends a message to the browser, directing it to move to another page. Example: Response.Redirect("default.a...
  • 11 Commonly used AJAX Frameworks
    There are hundreds of AJAX Frameworks available. Most commonly used frameworks are jQuery, MooTools, Prototype, ASP.NET AJAX, Apache Wicket,...
  • GET vs POST: Which one is better? A 10 point comparision
    1. Data Size Restriction in GET: There is a character restriction of 255 in the URL. This is mostly the old browsers restriction and new on...

Categories

  • AJAX
  • C++
  • CSS
  • Delphi
  • DOTNET
  • HTML
  • Javascript
  • jQuery
  • Management
  • Online Degrees
  • Oracle
  • Others
  • Phonegap
  • PHP
  • Unix
  • XML

Blog Archive

  • ▼  2012 (155)
    • ►  September (64)
    • ▼  August (11)
      • How important is grooming in professional life?
      • 7 Questions to Ask in Your Appraisal Meeting
      • 5 ways to handle workload at your workplace
      • Interview Tips: How to get prepared for an interview?
      • Phonegap on Blackberry: 2 Programming Tips
      • How to use FindComponent function in Delphi XE2?
      • How to use TADOTable in Delphi XE2?
      • How to use TADOQuery in Delphi XE2?
      • OnShortCut event of Delphi XE2 Forms
      • Phonegap: An amazing combination of HTML5, CSS3 an...
      • Delphi 2010, Delphi XE and XE2: A comparison of fe...
    • ►  July (4)
    • ►  June (3)
    • ►  May (25)
    • ►  April (48)
Powered by Blogger.

About Me

Unknown
View my complete profile