Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:04:45+00:00 2026-06-13T13:04:45+00:00

I get the following error when trying to use the TorchPluging : file:///android_asset/www/web/index.html: Line

  • 0

I get the following error when trying to use the TorchPluging:

 file:///android_asset/www/web/index.html: Line 12 : Uncaught TypeError: Cannot read property 'Torch' of undefined

I added the plugin to config.xml (I think it has changed from plugins.xml to config.xml in the newer phonegap versions?)

The following is my entire index.html

    <!DOCTYPE HTML>
<html>
    <head>
        <title>Flashlight</title>
        <script type="text/javascript" charset="utf-8" src="js/cordova-2.1.0.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/jquery-1.8.2.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/Torch.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/bootstrap.min.js"></script>
        <script type="text/javascript">
            function turnTorchOn(){

                window.plugins.Torch.turnOn( 
                function() { console.log( "turnOn" ) }                          // success
                ,   function() { console.log( "error" ) });                           // error
            }
        </script>
    </head>
    <body>
        <button id="turnOnButton" name="turnOnButton" > Turn on Flashlight</button>
        <script>

            $('#turnOnButton').click(function(){
                alert("will turn on now");
                turnTorchOn();
                alert("called turnOn done");

            });
        </script>
    </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:04:46+00:00Added an answer on June 13, 2026 at 1:04 pm

    It actually isn’t that hard to update an older style plugin to one that will work in 2.0.0+. You would need to:

    1. Modify the JS to the new cordova.define() style of declaring plugins.
    2. Update the package reference to org.apache.cordova.* from com.phonegap.* in the Java code.
    3. Make sure you are not calling any deprecated API’s.

    I’ve written a couple of blog posts that cover the topic. If you do follow them an update the Torch plugin you should submit a pull request so everyone can enjoy your work.

    2.0.0 Plugin – http://simonmacdonald.blogspot.ca/2012/08/so-you-wanna-write-phonegap-200-android.html
    Deprecated API’s – http://simonmacdonald.blogspot.ca/2012/07/phonegap-android-plugins-sometimes-we.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error when trying to use Response.Redirect in one of my
When trying to use convert(1), I get the following error: dyld: Library not loaded:
I get the following error trying to use the devise_suspendable gem. /home/graeme/.rvm/gems/ree-1.8.7-2011.03@epra/gems/devise-1.4.5/lib/devise/models.rb:60:in `const_get': uninitialized
I get the following error when trying to use: typedef QSharedPointer<Test> CTest CTest* Module::function(params)
I am trying to use delayed_job on heroku and I get the following error:
I get the following error when trying to use the SelectCommand of an SqlDataSource
I am trying to use gmail smtp using node_mailer . I get following error
I am trying to use a context menu and I get the following error
Trying to use logrotate and I get the following error when I run the
When starting Eclipse I get the following error: Obviously it's trying to use javaw.exe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.