public final class CallControl
extends java.lang.Object
Provides constants for use with ContentResolver
as well as a set of
handy methods to simplify routine operations.
Modifier and Type | Class and Description |
---|---|
static class |
CallControl.Lookup
Contract class for Lookup results.
|
static class |
CallControl.Report
Reported number.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACTION_3RD_PARTY_ACCESS
Intent action to open 3rd party apps access control in Call Control UI.
|
static java.lang.String |
ACTION_BLOCKED_LIST
Intent action to open Blocked List.
|
static java.lang.String |
ACTION_LOOKUP
Intent action to lookup number via Call Control UI.
|
static java.lang.String |
ACTION_REPORT
Intent action to lookup number via Call Control UI.
|
static java.lang.String |
EXTRA_PHONE_NUMBER
Intent extra key for phone number passed along.
|
static android.net.Uri |
LOOKUP_CALL_URI
Uri for looking up calls
|
static android.net.Uri |
LOOKUP_TEXT_URI
Uri for looking up text messages
|
static java.lang.String |
MIME_TYPE_LOOKUP_RESULT
Mime type for lookup results in
Cursor |
Modifier and Type | Method and Description |
---|---|
static boolean |
lookupNumber(android.content.Context context,
java.lang.String phoneNumber)
Performs a number lookup in Call Control UI.
|
static boolean |
lookupNumber(android.content.Context context,
java.lang.String phoneNumber,
int intentFlags)
Performs a number lookup in Call Control UI.
|
static boolean |
openAccessSettings(android.content.Context context)
Opens access settings for 3rd party apps within Call Control UI.
|
static boolean |
openAccessSettings(android.content.Context context,
int intentFlags)
Opens access settings for 3rd party apps within Call Control UI.
|
static boolean |
openBlockedList(android.content.Context context)
Opens Blocked List in Call Control.
|
static boolean |
openBlockedList(android.content.Context context,
int intentFlags)
Opens Blocked List in Call Control.
|
static boolean |
openBlockedList(android.content.Context context,
java.lang.String phoneNumber)
Opens specified number in Blocked List in Call Control if possible.
|
static boolean |
openBlockedList(android.content.Context context,
java.lang.String phoneNumber,
int intentFlags)
Opens specified number in Blocked List in Call Control if possible.
|
static boolean |
report(android.content.Context context,
java.util.ArrayList<CallControl.Report> reports)
Reports a set of numbers via Call Control UI.
|
static boolean |
report(android.content.Context context,
java.util.ArrayList<CallControl.Report> reports,
int intentFlags)
Reports a set of numbers via Call Control UI.
|
static boolean |
report(android.content.Context context,
CallControl.Report report)
Reports a number via Call Control UI.
|
static boolean |
report(android.content.Context context,
CallControl.Report report,
int intentFlags)
Reports a number via Call Control UI.
|
public static final android.net.Uri LOOKUP_CALL_URI
public static final android.net.Uri LOOKUP_TEXT_URI
public static final java.lang.String MIME_TYPE_LOOKUP_RESULT
Cursor
public static final java.lang.String ACTION_BLOCKED_LIST
Intent can optionally contain EXTRA_PHONE_NUMBER
to open specific number record, if any.
public static final java.lang.String ACTION_LOOKUP
Intent must contain EXTRA_PHONE_NUMBER
.
public static final java.lang.String ACTION_REPORT
Intent must contain EXTRA_PHONE_NUMBER
.
public static final java.lang.String ACTION_3RD_PARTY_ACCESS
public static final java.lang.String EXTRA_PHONE_NUMBER
public static boolean openBlockedList(android.content.Context context)
context
- Context where Context.startActivity(Intent)
will be executed.public static boolean openBlockedList(android.content.Context context, int intentFlags)
context
- Context where Context.startActivity(Intent)
will be executed.intentFlags
- Flags that should be set to the Intent
. See Intent.setFlags(int)
for details.public static boolean openBlockedList(android.content.Context context, java.lang.String phoneNumber)
If the number is null, the behavior is identical to openBlockedList(Context)
.
context
- Context where Context.startActivity(Intent)
will be executed.phoneNumber
- Phone number to present.public static boolean openBlockedList(android.content.Context context, java.lang.String phoneNumber, int intentFlags)
If the number is null, the behavior is identical to openBlockedList(Context)
.
context
- Context where Context.startActivity(Intent)
will be executed.phoneNumber
- Phone number to present.intentFlags
- Flags that should be set to the Intent
. See Intent.setFlags(int)
for details.public static boolean lookupNumber(android.content.Context context, java.lang.String phoneNumber)
context
- Context where Context.startActivity(Intent)
will be executed.phoneNumber
- Phone number to lookup.public static boolean lookupNumber(android.content.Context context, java.lang.String phoneNumber, int intentFlags)
context
- Context where Context.startActivity(Intent)
will be executed.phoneNumber
- Phone number to lookup.intentFlags
- Flags that should be set to the Intent
. See Intent.setFlags(int)
for details.public static boolean report(android.content.Context context, CallControl.Report report)
Will present Call Control UI which interacts with user.
After user confirms the report, he is asked if he wants to also add the number to Blocked List.
context
- Context where Context.startActivity(Intent)
will be executed.report
- Report about a number.public static boolean report(android.content.Context context, CallControl.Report report, int intentFlags)
Will present Call Control UI which interacts with user.
After user confirms the report, he is asked if he wants to also add the number to Blocked List.
context
- Context where Context.startActivity(Intent)
will be executed.report
- Report about a number.intentFlags
- Flags that should be set to the Intent
. See Intent.setFlags(int)
for details.public static boolean report(android.content.Context context, java.util.ArrayList<CallControl.Report> reports)
Reports a set of numbers via Call Control UI.
Will present Call Control UI which interacts with user.
After user confirms the report, the number is also added to Blocked List.
IMPORTANT: Must contain the list with ALL items having the same value of the CallControl.Report.isUnwanted
flag.
I.e. in one run you only report either unwanted or wanted numbers, but you cannot mix them in one call.
Safe to execute with empty list, does nothing in this case.
Useful when user enables the integration and the application wants to put already known blocked numbers to Call Control in one run.
context
- Context where Context.startActivity(Intent)
will be executed.reports
- List of numbers to report. Must all have identical CallControl.Report.isUnwanted
flag.java.lang.IllegalArgumentException
- When CallControl.Report.isUnwanted
is not the same for all numbers.public static boolean report(android.content.Context context, java.util.ArrayList<CallControl.Report> reports, int intentFlags)
Reports a set of numbers via Call Control UI.
Will present Call Control UI which interacts with user.
After user confirms the report, the number is also added to Blocked List.
IMPORTANT: Must contain the list with ALL items having the same value of the CallControl.Report.isUnwanted
flag.
I.e. in one run you only report either unwanted or wanted numbers, but you cannot mix them in one call.
Safe to execute with empty list, does nothing in this case.
Useful when user enables the integration and the application wants to put already known blocked numbers to Call Control in one run.
context
- Context where Context.startActivity(Intent)
will be executed.reports
- List of numbers to report. Must all have identical CallControl.Report.isUnwanted
flag.intentFlags
- Flags that should be set to the Intent
. See Intent.setFlags(int)
for details.java.lang.IllegalArgumentException
- When CallControl.Report.isUnwanted
is not the same for all numbers.public static boolean openAccessSettings(android.content.Context context)
context
- Context where Context.startActivity(Intent)
will be executed.public static boolean openAccessSettings(android.content.Context context, int intentFlags)
context
- Context where Context.startActivity(Intent)
will be executed.intentFlags
- Flags that should be set to the Intent
. See Intent.setFlags(int)
for details.