Get the participant of the current call

I want to get the participant, specifically the name from an incoming call (if the number is stored in the local address book).
The only way I see to get the name is to look at the call log. It seems that the current call is added only after he's finished well.
It seems not possible to search for a number using BlackberryContactList, because need names for the entry.

Any ideas?

Probably not the cleanest because I didn't spend too much time on this, but I think that's what you're looking for:

Place in the earpiece of your phone callConnected method

//incomingcall: static boolean variable set to true during a callIncoming event
        if(incomingcall)
        {
            PhoneCall pc = Phone.getActiveCall();

            String number = pc.getDisplayPhoneNumber();

            //getDisplayPhoneNumber() method returns a label as well as the number
            //if caller is a contact, these lines will parse it.
            number = number.substring(number.indexOf(' '));
            number = number.trim();            

            try{
                BlackBerryContactList bbcl = (BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST,PIM.READ_ONLY);
                Enumeration enumerate = bbcl.items();

                //iterate through contacts
                while(enumerate.hasMoreElements())
                {
                    Contact c = (Contact)enumerate.nextElement();

                    PIMList pimlist = c.getPIMList();
                    int[] intarray = c.getFields();

                    for(int x = 0; x < intarray.length; x++)
                    {
                        if (pimlist.getFieldDataType(intarray[x]) == PIMItem.STRING) {
                            if(intarray[x] == c.TEL)
                            {
                                                                for(int y=0; y < c.countValues(Contact.TEL); y++)
                                {
                                    //see if opened contact matches the number
                                    if(c.getString(Contact.TEL, y).equals(number))
                                    {
                                        //Caller's name stored in namearray
                                        String[] namearray = c.getStringArray(Contact.NAME,0);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch(PIMException e) {}

            incomingcall = false;

EDIT: Keep in mind that this is probably not very effective, since it will iterate through EACH issue of EACH contact.

Another thing to note is that some fields (work2, home2) were not supported and are not accessible until 4.5 so if the number is stored in these areas, you cannot get the name of the contact with this method.

Tags: BlackBerry Developers

Similar Questions

  • Get the current value of the menu a cluster ring

    Hello

    I am trying to program a bunch of rings of menu to use the same options and disable the option even in the other rings of menu if it has already been chosen. It works essentially as is at the moment, but it shows each button by using a 'deactivated' option because I'm turning off the option even in the buttons that have this value. I did it using a loop knot and property and [] DisabledItems en mass. Now, I want to go to the iteration of the loop for the menu ring which already has this value.

    To do this however, I want to get the current numeric value of the ring of menu and an array of search values. If the value of menu rings appear in this table, then I want to move to the current iteration of the loop. The problem I have is that when I try to use a property node and type the property value, instead of giving me a long 32 output, it gives me the so-called 'Variant', which I have not seen before. I'm not sure how to find a table and see if the value I have is in this table. "Search table" seems just an index to be returned, I think that I want a Boolean or something. I'm also not sure how to skip an iteration of the loop (although I imagine it won't be too difficult to understand mine, I hope).

    I apologize if this is very obvious, or if my message is not clear. I started using LabVIEW, a few weeks ago and I'm still learning. I have included a picture of my Subvi downstairs.

    Thank you
    Nathan

    Variant of data allows to convert the variant to a numeric type (whatever representation you need).

    Search D 1 table returns-1 if the element was not found.  If you just compare the index with a greater or equal to zero and the result will be if the element was found in the table.

  • How can I get the current paragraph?

    I want to get the current paragraph where the insertion point is.

    How can I do this in FDK?

    Ch,

    I can answer some of these questions, but if you have decided that this thread is replied, please give credit to Mike.

    About the audit for a FO_Pgf object, you shouldn't have that. I think that there is some obscure cases where F_ApiGetTextRange() gives you an object that is not a paragraph... I forgot exactly but I think it has to with a text graphic subject line or something like that. I could be wrong. In any case, if you have a stream of regular text with an insertion point, you will get a paragraph object.

    This line will abort the operation if any text is selected. Do you really want that?

    If (insertionPoint.beg.objId! = insertionPoint.end.objId)

    This line will abort the operation if several paragraphs are selected. Do you really want that? Without this verification, you will always get the text of the first selected paragraph.

    If (insertionPoint.beg.offset! = insertionPoint.end.offset)

    Otherwise, the code looks OK to me, at least regarding the FDK calls. You have problems with him?

    Russ

  • CP8 Question: can I get the current URL path in a variable?

    Hello

    I want to get the current. HTM path and name of the file into a variable.

    An example would be http://mycompanyserver/training/health_and_safety/infection_prevention.htm

    I created a user variable called myurl

    In slide 1 to the output, I used some javascript I found on the internet var myurl = window.location.pathname;

    On slide 2, I set a text caption to display the myurl

    I published and took my server project.

    The result was an empty box of legend.

    Please, someone could suggest what I should use.

    (I don't want to use the Captivate system variable $$cpInfoProjectName$ $ like is not what I want)

    Thank you

    Peter

    Cardiff (cold, covered, wind and rain. A dark day)

    In Wales

    UK.

    Run this onSlideEnter of the first slide:

    If (window.cpAPIInterface)

    {

    window.cpAPIInterface.setVariableValue ('myurl', document.location.href)

    }

  • get the current event (name) of a field - possible / how to?

    Hello

    I wonder if it is possible to get the name of a field as event:

    (form.pag1.mytextfield::enter - JavaScript, client)

    var eventname = this.MagicJSfunction();
    

    It is of course possible to get the current name of the event with:

    (form.pag1.mytextfield::enter - JavaScript, client)

    var eventname = event.name; 

    It's a shame it's always = 'Focus' wherever I use it (form.pag1.mytextfield::ENTER - JavaScript, client) (form.pag1.mytextfield::EXIT - JavaScript, client)

    (form.pag1.mytextfield::enter - JavaScript, client)

    my_scripting_obj.my_set_design_function(this, eventname);

    Reason:

    I use to change the structure of a field in realtion to his event in my script object. By calling the function of my script object, I'd use some copy/paste.

    I have more than 120 field where this function must be called to enter and exit the event.

    Hello

    Does that help? http://assure.ly/h8ZLr5.

    In this case, I call the function entry and exit of the events of each field.

    Niall

  • How to get the current state of the son process

    Hello

    If I know that the instance id of a child process.
    How can I get the current state of the child (e.g., completed, running, etc.) process in the code "PBL"?

    Thank you in advance.

    Hello

    Here's a way to display the status of children sub-process engendered by a process parent process creation activity. In this sense, the process id of the subprocedure is "ChildProcess. The id of the activity of creating processes in the parent process that causes the work item instance in the child process called 'SpawnChildren '. This logic is performed from inside the process parent in an activity downstream process creation activity, called "SpawnChildren".

    Display statements have been added just to see you return values (do) their leash not when going into production.

    display "Children: " + children + "\nKeys: " + children.keys + "\nLength: " + length(children) +
    "\nInstance id of child: [" + children["SpawnChildren"] + "]"
    
    if children["SpawnChildren"] = null or children["SpawnChildren"] = "" then
         display "Child is completed"
    else
    
         bp as BusinessProcess
    
         connectTo bp
                         using url = Fuego.Server.directoryURL,
                             user = "test",
                             password = "test",
                             process = "/ChildProcess"
    
         instance as Fuego.Papi.Instance
         instance = getInstance(bp, instance : children["SpawnChildren"])
         logMessage "run Instance: " + instance.id
                          using severity = DEBUG
    
         display "Status: " + instance.status + "; inside the child process in the activity: " + instance.activityName
    
         disconnectFrom bp
    end
    

    I downloaded the project I used this in to http://www.4shared.com/file/130890113/2d825960/ChildrenOfaParent.html.

    Hope this helps,
    Dan

  • Get the current language settings in the Custom Validation rule?

    Hello

    I read the book from Guide JDevelopers
    "In 26.9' custom application Validation rules.
    I ran the example to create custom Validation rules
    I ran my validation rule for English and Italian language using 'Message Bundles'
    I had EntityImplMsgBundle and EntityImplMsgBundle_it for the Italian language
    The Question is:
    Is it possible to get the current settings of the language used "get of in my custom validation class?
    I need to know if the current language is 'in' or 'it '.

    When I test my Applicaton of Module I can choose the configuration name: English EntityLocal and EntityLocalIT for the Italian language
    Can I access this validation custome bean?

    Kind regards.

    Hello

    Yes, you can access the local current in your validation rule by accessing the current session through the source of the entity object DBTransaction object. This is done by calling:

    ((EntityImpl)valCtx.getSource()).getDBTransaction().getSession().getLocale()
    

    HTH,
    Patrik

  • I reinstalled Firefox Desktop, I downloaded my favorites of Carbonite, how can I get the current Firefox to accept?

    See above

    I reinstalled Firefox Desktop, I downloaded my favorites of Carbonite, how can I get the current Firefox to accept?

    You do backup your bookmark as a .json file?

    Restoration of bookmark

  • I want to get the current music, I have on my iPod out of it and start again. How can I do this?

    I want to get the current music, I have on my iPod out of it and start again. How can I do this?

    Open iTunes, plug in the iPod, select what you want to be on your iPod, sync.

  • Get the current value of a control of the ring

    I have a control of the ring that has the following values. See attacment. I need to get the current value of this one and use it as input for another function, but First I would like to get the current value and save ina text file. I tried this

    if (event == EVENT_LEFT_CLICK_UP) || (event == EVENT_LEFT_CLICK_DOWN)
    {
        int p;
        GetCtrlVal (panelHandle, PANEL_RINGSLIDE_1, &p);
        FILE *OutFile = fopen("C:\\Users\\Student\\Desktop\\ringtest.txt","w");
        fprintf(OutFile,p);
        fclose(OutFile);
    
    }
    

    I need to get the current value of the ring (& p) to write to the file ringtest.txt.

    Also, I need to use this value (& p) as another entry in the same program.

    IE value of & p must be used in

    b = c * 5; where c is the value of the current & p.

    Can any 1 help?

    You're right: EVENT_LEFT_CLICK_DOWN is not a valid event for the CVI. Valid events are listed in the userint.h file, and are the only events that can be caught in the trap in a point of order. On the other hand, you're assuption on EVENT_VAL_CHANGED is correct: you can trap forget the EVENT_CLICK_UP event.

    According to the second question, looking at the definition for fprintf you must pass a string format as the second parameter to the function, then the value to write to the file. In your case, the correct syntax is:

    fprintf (OutFile, "%d", p);

  • problem to get the current date in qml

    Hello world

    I'm trying to get the current date in c ++ and qml and I used the class QDate, but it still has some problems:

    Code:

    =====================================================

    QDate * nowdate = new QDate;
    QDeclarativePropertyMap * nowdateMap = new QDeclarativePropertyMap;
    nowdateMap-> insert ("date", QVariant (nowdate-> currentDate()));
    QML-> setContextProperty ("nowdateMap", nowdateMap);

    ===========================================================

    After setting the nowdateMap, I'm able to get the date in the application, but the format is really weird, I did not use QDatetime, but the restult of shows like ' 2013-1 - 3 T 00: 00:00 ", how can I get rid of the final"T00:00:00 "? or is there a better way to get the current date?

    Thank you

    QDate nowdate is QDate::currentDate();.

    QString nowdatestring = nowdate.toString (); / / to get the date string format, you can define the shape of toString(), you can //search it
    QDeclarativePropertyMap * nowdateMap = new QDeclarativePropertyMap;
    nowdateMap-> insert ("date", QVariant (QString (nowdatestring)));
    QML-> setContextProperty ("nowdateMap", nowdateMap);

    then in the file qml, using nowdateMap.date will do.

  • Get the current Message of the new screen open message context

    When you open the application again [email] message you can use a ViewListenerExtended to get the current context of Message... but the user every interaction with the fields of composition creates a new Message object if you hold is no longer a valid reference (he gets cloned). By changes, I mean using the menu items to add/remove fields, typing in a topic, etc. Does anyone know how to get the context of new/current Message used while the demand again message is open and has been updated? MessageListener does not work for Messages being changed in the application of the new message.

    Update: the subject of the message is not be cloned, UI updates not the model.

  • How to get the current timestamp in C++ to the BB10 project

    Please help me how to get the current timestamp in C++. Thanks for your help!

    Following your suggestion,

    QTime is only for a day.  http://developer.BlackBerry.com/Cascades/reference/QTime.html#details

    I found "QDateTime" of references of the API: http://developer.blackberry.com/cascades/reference/qdatetime.html#toTime_t

    QDateTime = now QDateTime::currentDateTime();
    timestamp long = now.toTime_t ();

    But I got an error. I searched but no results are clear:

    -variable 'QDateTime now' initializer has but
    incomplete type
    -type incomplete "QDateTime" used in the nested name
    specifier of

    I am a newbie. So thank you for your help

  • How to get the current wording of the BlackBerry device with the BlackBerry App?

    Hello!

    I'm new to BlackBerry,

    Can u tell me pls, how to get the current language of the device using the program...

    PLS, suggest me...

    Locale.getDefaultForSystem () will give you the regional settings currently selected.

  • How to get the current GPS position of the BlackBerry emulator?

    Hello! all, I am writing a simple program to get the current coordinates of GPS (Latitude, Longitude) in BlackBerry.

    Criteria criteria=new Criteria();
            criteria.setHorizontalAccuracy(500);
            criteria.setVerticalAccuracy(500);
            LocationProvider locationProvider=LocationProvider.getInstance(criteria);
            Location location=locationProvider.getLocation(60);
            QualifiedCoordinates coordinates=location.getQualifiedCoordinates();
            System.out.println("Latitude : "+coordinates.getLatitude()+" Longitude : "+coordinates.getLongitude());
    

    But, I couldn't get the latitude and longitude. It returns 0 (zero) for the two coords.

    PLS, suggest me the solution.

    The 9000 Simulator has GPS simulation. In the "Simulation" of the Simulator menu, select "GPS". There is an already defined test site, you will need to select this place.

Maybe you are looking for