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

Java Development

Reply
New Developer
Posts: 13
Registered: ‎07-15-2008
My Device: Not Specified

Not able to invoke blackberry phone app from my app

HI,

 

I am using JDE 4.3 and testing my app on emulator.

 

I am trying to invoke blackberry's phone app from my application as follows

 

Please note i am inoking phone app in the function of FieldChangeListener interface implemented by a class in my app.

 

public void fieldChanged(Field field, int context)
{

.

.

PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL, DestNumber); Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call);

.

.

}

 

Problem i am seeing is that phone app is not invoked at all as i couldn't see phone app screen trying to initiate outgoing call.

 

What could be the reason ? Kindly provide inputs.

 

regards,

-nitin

Developer
Posts: 445
Registered: ‎07-15-2008
My Device: Not Specified

Re: Not able to invoke blackberry phone app from my app

Try to set the permissions for the application.

Go to Options -> Advanced Options -> Applications -> <yourApp> -> MenuButton -> Set permissions to 'Allow'. 

If your question was answered, please accept it as a sollution and / or give Kudos ;-)
______________________________
Use the Search Field first! Maybe the question you want to ask already exists!
New Developer
Posts: 13
Registered: ‎07-15-2008
My Device: Not Specified

Re: Not able to invoke blackberry phone app from my app

thanks for the quick reply..

unfortunately i am not able to see my application name under Options -> Advanced Options -> Applications ->

here is my code


package com.rim.bbsmmclient;

import com.rim.bbsmmclient.resource.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.i18n.*;
import net.rim.device.api.applicationcontrol.*;
import net.rim.blackberry.api.phone.*;
import net.rim.blackberry.api.invoke.*;

public final class BBSMMClient extends UiApplication implements FieldChangeListener
{
private BBSMMClientScreen mainScreen;
private ButtonField callButton;
private EditField destinationNumberField;
private String destNumber;

public static void main(String[] args)
{
BBSMMClient theApp = new BBSMMClient();
theApp.enterEventDispatcher();
}

public BBSMMClient()
{
mainScreen = new BBSMMClientScreen();
mainScreen.setTitle(new LabelField("BBSMMClient", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
showCallScreen();
pushScreen(mainScreen);
}

private void showCallScreen()
{
mainScreen.add(new LabelField("Destination Number", Field.NON_FOCUSABLE));

destinationNumberField = new EditField(Field.EDITABLE | Field.FIELD_LEFT | Field.FOCUSABLE | BasicEditField.FILTER_NUMERIC);
destinationNumberField.setMaxSize(15);
mainScreen.add(destinationNumberField);

//empty line
mainScreen.add(new LabelField("", Field.NON_FOCUSABLE));

callButton = new ButtonField("Call", Field.HIGHLIGHT_SELECT);
callButton.setChangeListener(this);
mainScreen.add(callButton);
}

public void fieldChanged(Field field, int context)
{
ButtonField TempButton = (ButtonField) field;

if (TempButton.getLabel() == "Call")
{
//initiate call
destNumber = destinationNumberField.getText();
PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL, destNumber);
Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call);
}
}
}

final class BBSMMClientScreen extends MainScreen
{
public BBSMMClientScreen()
{
super();
}

public boolean onClose()
{
Dialog.alert("Good bye");
//System.exit(0);
close();
return true;
}
}


*********************


btw in another test application i could able to invoke phone app using the example (Creating a new menu item in a BlackBerry Java Application on page 42) of development guide for 4.3.


regards,

-nitin
Developer
Posts: 1,627
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Not able to invoke blackberry phone app from my app

I have this problem too on some simulators.  try switching to a newer sim but it does work on the real device.

 

BlackBerry Development Advisor
Posts: 15,724
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Not able to invoke blackberry phone app from my app

The application won't show up in the installed Applications list if it was installed using javaloader or in the case of the BlackBerry Simulator, copied to the simulator directory.  You can still adjust an applications settings by selecting Edit Default Permisions from the menu of the application list.

 

However, by default the BlackBerry simulator does not enforce these permissions.  Are you getting any exception when you try to invoke the phone?  Are you able to invoke any other types of applications?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 13
Registered: ‎07-15-2008
My Device: Not Specified

Re: Not able to invoke blackberry phone app from my app

HI All,

 

I am not getting any exception.

 

I had posted following issue on old /www.blackberry.com/developers/forum/

Retrieve dialled number

http://www.blackberry.com/developers/forum/thread.jsp?forum=1&thread=14758&message=51067&q=nitin#51067

 

In above scenario i was able to invoke default phone app in my code by selecting my customized menuitem which i was adding in phone book contact and in default phone app itself

 

But in the new code snippet i posted in this thread i am not able to invoke default phone app.

 

I don't understand this difference in behaviour

 

regards,

-nitin

 

 

Developer
Posts: 21
Registered: ‎07-16-2008
My Device: Not Specified

Re: Not able to invoke blackberry phone app from my app

I can only see one reason why it shouldn't be working and that's if it isn't getting to the invoke line.  Have you debugged it and stepped through it?  Are you getting to the invoke line?  The reason I ask this is because I noticed that Strings are kind of picky about the == operator.  Try changing if (TempButton.getLabel() == "Call") to if(TempButton.getLabel().equals("Call")) maybe.
Highlighted
New Developer
Posts: 13
Registered: ‎07-15-2008
My Device: Not Specified

Re: Not able to invoke blackberry phone app from my app

Yes PaoloLim, i have debugged my code and control does go to invoke line. Yes it indeed works on device but b'cos of this issue i am not able to test another issue, which i am facing on device, on simulator.

Link to my other issue where i need testing on simulator.

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=3436#M3436

 

need help as i am stuck with the problem from quite a sometime :-(