Search This Blog

Saturday, 15 December 2012

How to get the call details from PhoneListener

So here is the one how to get the call details and send it to somewhere on remote database.


As i mentioned earlier how to integrate PhoneListener:

here are the functions to over ride in Phone Listener , you may override any function as the name suggests when these functions will be called...
Create these variables in class:
PhoneCall _phoneCall;
String _phoneNumber;
int _callduration;

first add your phone listener:


ii  am getting call details when the call is incoming....

_phoneCall = Phone.getCall(CallID);
    _phoneNumber = _phoneCall.getDisplayPhoneNumber();

Now as you can see i am just getting the details here nothing else;

in CallDisconnected function:
_callDuration = _phoneCall.getElapsedTime();
//Call function to send data to server.....use invokeLater for this ...


Wednesday, 12 December 2012

Address Book fetching-iOS

Hello friends,
                so here is something new,if you wana give your users an option to select a contact from contact list , here is the code then.


First add two frameworks to your project:

Now simply in your view.header file where you want to provide this option, import below...

#import <AddressBookUI/AddressBookUI.h>

And, also add this delegate method:

ABPeoplePickerNavigationControllerDelegate  in your header file

now simply , do this whether on button click or anywhere...

   ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc]init];
    picker.peoplePickerDelegate = self;
    [self presentModalViewController:picker animated:YES];

Override these below functions  as :

-(void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker{
    [self dismissModalViewControllerAnimated:YES];

-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
    [self displayPerson:person];
    [self dismissModalViewControllerAnimated:YES];
    return NO;

-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
    return NO;

And here is the display person function:

        NSString* name = (__bridge_transfer NSString*)ABRecordCopyValue(person,kABPersonFirstNameProperty);
       //name string value contains the first name of contact as in contact list
        NSString* phone = nil;
        ABMultiValueRef phoneNumbers = ABRecordCopyValue(person,kABPersonPhoneProperty);
        if (ABMultiValueGetCount(phoneNumbers) > 0) {
            phone = (__bridge_transfer NSString*)
            ABMultiValueCopyValueAtIndex(phoneNumbers, 0);
        } else {
            phone = @"[None]";
       //phone string contains the selected contact's phone number.


Monday, 3 December 2012

How to use Filters on TextField in Blackberry

Hello friends,
                   Here it is how to use filters on TextFields in Blackberry.


Supose we have a TextField "_ph"...

We want to display a numeric keyboard for this obviously....
So here it is....

_ph = new TextField(TextFilter.NUMERIC);

there are lots of options like email,Hexadecimal,Integer,IP etc...