You Are Here:

Community: Developer Discussion Boards

#1 Old Lightbulb Answer to Retrieving SMS Sender Number - 2007-08-29, 17:15

Join Date: Aug 2007
Posts: 3
xenoflauge
Offline
Registered User
I came across lots of people asking how to retrieve the Sender's number from a received SMS in Python even if the contact is in your contacts database.
Here is a quick fix:

Code:
# Contact Number from Contacts dB
# XenoArts - John Robert Planta

import contacts           #import contact db

db = contacts.open()   #store in a variable "db"

def getSenderNum(sms_sender): 
	found = db.find(sms_sender)   #find in database the contact name
	try: found                   #check if found
	except NameError:
		senderData = found[0]
		senderNum = senderData.find("mobile_number")[0].value
	else:
		senderNum = sms_sender
	
	return senderNum   

#now all you have to do is assign a variable the number of that contact name

mobileNum = getSenderNum(contactName)

#change contactName to whatever variable you stored your  ripped contact
Incorporate this to your code to be able to get the number.
Good Luck.
Last edited by xenoflauge : 2007-08-30 at 01:16.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Retreiving the number of the sender of an sms christee Python 1 2006-04-13 14:13
How to get sms sender number? cars2003 General Symbian C++ 1 2005-05-12 13:15
how to email sms specifying a port number? dukehoops General Messaging 2 2004-04-27 13:38
when i get the sms how can know the number of sender chinazou305 Symbian Networking & Messaging 3 2003-12-22 03:56
How can I get the telephone number of the sender of an SMS? If i try get it ask_expert General Symbian C++ 1 2002-05-10 19:56

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia