www.webdeveloper.com
Results 1 to 2 of 2

Thread: android/phonegap Uncaught ReferenceError

  1. #1
    Join Date
    Jun 2013
    Posts
    1

    android/phonegap Uncaught ReferenceError

    I am getting the below exception when i try to invoke a javascript call from an android application that uses PhoneGap.

    Stacktrack error:

    Code:
        06-01 13:58:40.225: D/CordovaLog(1197): Uncaught ReferenceError: recieve is not defined
        06-01 13:58:40.225: E/Web Console(1197): Uncaught ReferenceError: recieve is not defined at null:1
    here is my .jp file

    Code:
            <!-- register -->
          
        		function register(toggle){
        		var e = toggle;
        		var value = e.options[e.selectedIndex].value;
        		console.info(toggle);
        		console.info(value);
        			if (value == "on"){
        				window.WRAPPER.register();
        			}else if(value == "off"){
        				window.WRAPPER.deregister();
        			}
        		
        		}
          
          
          <!-- send  -->
          
        		function send(message){
        			console.info('sending message');
        			console.info(message);
        			window.WRAPPER.send(message);
        		}
        	 
        	
        	<!-- recieve -->
        	 
        		function recieve(msg){
        			console.info('recieving message');
        			console.info(msg);
        			document.getElementById("textarea1").innerHTML = messages;
        		}
    Here is my android code that creates a javascript:functionName() string and loads it to the webView
    Code:
        String text = "hello";
    		
        String javaScript = "javascript:recieve(\'"+text+"\')";
    
        Log.d("TAG", javaScript);
    		
        loadUrl(javaScript);

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,672
    Code:
    function recieve(msg){
        			console.info('recieving message');
        			console.info(msg);
        			document.getElementById("textarea1").innerHTML = messages;
        		}
    i'm not familiar with Android, but looking in this code i can't understand where did you get the red variable from?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles