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
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330
Accepted Solution

TypeError: Result of Expression

TypeError: Result of expression 'blackberry.push.openBISPushListener' [undefined] is not a function.

 

This code is straight from the API Docs.  So whats wrong?

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
	<head>
	    <meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" />
		<title>Push Listener</title>
<script type="text/javascript">
  var port = 30326;
  var serverUrl = "http://pushapi.eval.blackberry.com/";
  var appId = "110319-8h9l07kk5r230i30204846MM95345R721";
  var max = 100;
  var wakeUpPage = "Home.htm";
 
  function openBISPushListener() {
    try {
      var ops = {port : port, appId : appId, serverUrl : serverUrl, wakeUpPage : 'Home.htm', maxQueueCap : max};
      blackberry.push.openBISPushListener(ops, onData, onRegister, onSimChange);
      alert("running pushlistener");
    }
    catch (err) {
      alert(err);
    }     
  } 

  function onRegister(status) {
    if (status == 0) {
      alert("success");
    }
    else if (status == 1) {
      alert("network error");
    }
    else if (status == 2) {
      alert("rejected by server");
    }
    else if (status == 3) {
      alert("invalid parameters");
    }
    else if (status == -1) {
      alert("general error");
    }
    else {
      alert("unknown status");
    }
  }
	
  function onData(data) {
    var resultDiv = document.getElementById("resultDiv");
    try {
      resultDiv.innerHTML += "<br>" + blackberry.utils.blobToString(data.payload);
      return 0; //indicate acceptance of payload for reliable push
    } 
    catch (err) {
      alert(err);
    }
  }

  function onSimChange() {
    var resultDiv = document.getElementById("resultDiv");
    resultDiv.innerHTML += "<br>" + "SIM card is changed!";
     } 
          
</script>
	</head>
	<body onload="openBISPushListener();">
        <div id="resultDiv">
        </div>

 

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold

Re: TypeError: Result of Expression

Did you add the featureID - <feature id="blackberry.push" />- to your config.xml?



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330

Re: TypeError: Result of Expression

I have.
blackberry.app
.app.event
.identity
.invoke
.push
.system.
.ui.dialog
.utils
.invoke.JavaArguments
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold

Re: TypeError: Result of Expression

What version of the SDK are you using?



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330

Re: TypeError: Result of Expression

well thats it. there is a new sdk. Now my problem is I use visual studio which is no longer supported in the new sdk. I can still use it to develop but I have to package using the command line. OK My new question is will I have to get new signing keys and sign it after i package it?
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold

Re: TypeError: Result of Expression

Hi sabanim, 

 

You do not need new signing keys you just need to move your existing keys to the bin folder of the SDK. There are instructions here



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330

Re: TypeError: Result of Expression

ok so when they are in the bin file. They will get signed and compiled when I type. bbwp "c:\applications\devBlog\devBlog.zip" /s c.\BlackBerry WebWorks Packager\bin /g my password /o "no cluse what goes here" ?????? from http://docs.blackberry.com/en/developers/deliverables/32973/Sign_the_cod_file_for_a_BB_Widget_applic...
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold

Re: TypeError: Result of Expression

[ Edited ]
bbwp "c:\applications\devBlog\devBlog.zip" /g <my password>

 

 will suffice



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330

Re: TypeError: Result of Expression

Thanks for your help. It works Now I have an err Null! But that at least means its working.