The Calls plugin provides read-only access to the device call log.
Setup
The calls plugin is already registered in the default AppTemplate.
Android Manifest
<uses-permission android:name="android.permission.READ_CALL_LOG" />
API
calls.GetRecent(limit int) (CallLog, error)
Fetches the most recent call log entries.
Returns: CallLog containing Calls and Count
calls.GetLast(limit int) (CallLog, error)
An alias for GetRecent(limit).
calls.GetAll() (CallLog, error)
Fetches the entire call log.
Returns: CallLog or error
Types
CallLog
type CallLog struct {
Calls []CallRecord `json:"calls"`
Count int `json:"count"`
}
CallRecord
| Field | Type | Description |
|---|---|---|
ID |
int64 |
Stable row ID |
Number |
string |
Phone number or URI |
Type |
string |
"incoming", "outgoing", "missed", etc. |
Date |
int64 |
Epoch millis |
Duration |
int64 |
Duration in seconds |
CachedName |
string |
Contact name if available |
GeoLocation |
string |
Reverse-geocoded location if available |
Events
calls:changed
Emitted when the native side detects a call-log change.
Example
import "github.com/sweet-juice/sweetjuice/plugins/calls"
plugin := calls.NewPlugin()
log, err := plugin.GetAll()