If your application is in the foreground, its app delegate will receive a applicationWillResignActive message, but I don't believe there is a way to determine whether the message was sent as a result of an incoming call or a text message.
If your application is not in the foreground, there is no way to know.