capacitor-sms-inbox
A capacitor plugin to read SMS inbox
Install
npm install capacitor-sms-inbox
npx cap sync android
API
checkPermissions()
requestPermissions()
getCount(...)
getSMSList(...)
getRawSMSList(...)
- Interfaces
- Type Aliases
- Enums
checkPermissions()
checkPermissions() => Promise<PermissionStatus>
Returns: Promise<PermissionStatus>
requestPermissions()
requestPermissions() => Promise<PermissionStatus>
Returns: Promise<PermissionStatus>
getCount(...)
getCount(options: { filter?: SMSFilter; }) => Promise<{ count: number; }>
Param | Type |
---|---|
options |
{ filter?: SMSFilter; } |
Returns: Promise<{ count: number; }>
getSMSList(...)
getSMSList(options: { projection?: Projection; filter?: SMSFilter; }) => Promise<{ smsList: SMSObject[]; }>
Param | Type |
---|---|
options |
{ projection?: Projection; filter?: SMSFilter; } |
Returns: Promise<{ smsList: SMSObject[]; }>
getRawSMSList(...)
getRawSMSList(options: { filter?: SMSFilter; }) => Promise<{ rawSmsList: any; }>
Returns a raw sms object (all columns). Its like running SELECT * FROM ..
E.g.
{
"_id": 33,
"thread_id": 153,
"address": "TEST",
"person": null,
"date": 1679232404564,
"date_sent": 1679562604444,
"protocol": 0,
"read": 0,
"status": -1,
"type": 1,
"reply_path_present": 0,
"subject": null,
"body": "SMS body",
"service_center": "+918299901123",
"locked": 0,
"sub_id": 1,
"error_code": 0,
"creator": "com.google.android.apps.messaging",
"seen": 1,
"priority": -1
}
Note: This is a raw query and ineffecient. Use with caution
Param | Type |
---|---|
options |
{ filter?: SMSFilter; } |
Returns: Promise<{ rawSmsList: any; }>
Interfaces
PermissionStatus
Prop | Type |
---|---|
sms |
PermissionState |
SMSFilter
Prop | Type | Default |
---|---|---|
type |
MessageType |
MessageType.INBOX |
id |
number |
|
threadId |
number |
|
body |
string |
|
bodyRegex |
string |
|
address |
string |
|
addressRegex |
string |
|
minDate |
number |
|
maxDate |
number |
|
indexFrom |
number |
|
maxCount |
number |
SMSObject
Prop | Type |
---|---|
id |
number |
threadId |
number |
type |
MessageType |
address |
string |
creator |
string |
person |
string |
date |
number |
dateSent |
number |
subject |
string |
body |
string |
Projection
Prop | Type | Default |
---|---|---|
id |
boolean |
true |
threadId |
boolean |
true |
type |
boolean |
true |
address |
boolean |
true |
creator |
boolean |
false |
person |
boolean |
false |
date |
boolean |
true |
dateSent |
boolean |
false |
subject |
boolean |
true |
body |
boolean |
true |
Type Aliases
PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
Enums
MessageType
Members | Value |
---|---|
ALL |
0 |
INBOX |
1 |
SENT |
2 |
DRAFT |
3 |
OUTBOX |
4 |
FAILED |
5 |
QUEUED |
6 |