UNPKG

1.53 kBTypeScriptView Raw
1/**
2 * Options for sending an SMS
3 */
4export interface SmsOptions {
5 /**
6 * Set to true to replace \n by a new line. Default: false
7 */
8 replaceLineBreaks?: boolean;
9 android?: SmsOptionsAndroid;
10}
11export interface SmsOptionsAndroid {
12 /**
13 * Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app.
14 */
15 intent?: string;
16}
17/**
18 * @name SMS
19 * @description
20 *
21 * Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
22 *
23 * @usage
24 * ```typescript
25 * import { SMS } from 'ionic-native';
26 *
27 *
28 * // Send a text message using default options
29 * SMS.send('416123456', 'Hello world!');
30 * ```
31 * @interfaces
32 * SmsOptions
33 * SmsOptionsAndroid
34 */
35export declare class SMS {
36 /**
37 * Sends sms to a number
38 * @param phoneNumber {string|Array<string>} Phone number
39 * @param message {string} Message
40 * @param options {SmsOptions} Options
41 * @returns {Promise<any>} Resolves promise when the SMS has been sent
42 */
43 static send(phoneNumber: string | string[], message: string, options?: SmsOptions): Promise<any>;
44 /**
45 * This function lets you know if the app has permission to send SMS
46 * @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if we have permission
47 */
48 static hasPermission(): Promise<boolean>;
49}