Partager via


Telephony Class

Definition

The Telephony provider contains data related to phone operation, specifically SMS and MMS messages, access to the APN list, including the MMSC to use, and the service state.

[Android.Runtime.Register("android/provider/Telephony", DoNotGenerateAcw=true)]
public sealed class Telephony : Java.Lang.Object
[<Android.Runtime.Register("android/provider/Telephony", DoNotGenerateAcw=true)>]
type Telephony = class
    inherit Object
Inheritance
Telephony
Attributes

Remarks

The Telephony provider contains data related to phone operation, specifically SMS and MMS messages, access to the APN list, including the MMSC to use, and the service state.

<p class="note"><strong>Note:</strong> These APIs are not available on all Android-powered devices. If your app depends on telephony features such as for managing SMS messages, include a <uses-feature>https://developer.android.com/guide/topics/manifest/uses-feature-element.html element in your manifest that declares the "android.hardware.telephony" hardware feature. Alternatively, you can check for telephony availability at runtime using either android.content.pm.PackageManager#hasSystemFeature hasSystemFeature(PackageManager.FEATURE_TELEPHONY) or android.telephony.TelephonyManager#getPhoneType.</p>

<h3>Creating an SMS app</h3>

Only the default SMS app (selected by the user in system settings) is able to write to the SMS Provider (the tables defined within the Telephony class) and only the default SMS app receives the android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION broadcast when the user receives an SMS or the android.provider.Telephony.Sms.Intents#WAP_PUSH_DELIVER_ACTION broadcast when the user receives an MMS.

Any app that wants to behave as the user's default SMS app must handle the following intents: <ul> <li>In a broadcast receiver, include an intent filter for Sms.Intents#SMS_DELIVER_ACTION ("android.provider.Telephony.SMS_DELIVER"). The broadcast receiver must also require the android.Manifest.permission#BROADCAST_SMS permission.

This allows your app to directly receive incoming SMS messages.

</li> <li>In a broadcast receiver, include an intent filter for Sms.Intents#WAP_PUSH_DELIVER_ACTION} ("android.provider.Telephony.WAP_PUSH_DELIVER") with the MIME type "application/vnd.wap.mms-message". The broadcast receiver must also require the android.Manifest.permission#BROADCAST_WAP_PUSH permission.

This allows your app to directly receive incoming MMS messages.

</li> <li>In your activity that delivers new messages, include an intent filter for android.content.Intent#ACTION_SENDTO ("android.intent.action.SENDTO" ) with schemas, sms:, smsto:, mms:, and mmsto:.

This allows your app to receive intents from other apps that want to deliver a message.

</li> <li>In a service, include an intent filter for android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE ("android.intent.action.RESPOND_VIA_MESSAGE") with schemas, sms:, smsto:, mms:, and mmsto:. This service must also require the android.Manifest.permission#SEND_RESPOND_VIA_MESSAGE permission.

This allows users to respond to incoming phone calls with an immediate text message using your app.

</li> </ul>

Other apps that are not selected as the default SMS app can only <em>read</em> the SMS Provider, but may also be notified when a new SMS arrives by listening for the Sms.Intents#SMS_RECEIVED_ACTION broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This broadcast is intended for apps that&mdash;while not selected as the default SMS app&mdash;need to read special incoming messages such as to perform phone number verification.

For more information about building SMS apps, read the blog post, Getting Your SMS Apps Ready for KitKat.

Java documentation for android.provider.Telephony.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to