Class DynamicLinkUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
addContact
(Context context, String[] names, String[] nicknames, String pronunciation, String[] phones, String[] phoneTypes, String[] emails, String[] emailTypes, String[] addresses, String[] addressTypes, String birthday, String title, String organization, String[] websites, String note) Launch add contact intent according to the supplied parameters.static boolean
addEvent
(Context context, String title, long startTime, long endTime, boolean allDay, String organizer, String location, String description) Launch add calendar event intent according to the supplied parameters.static boolean
View or bookmark URL according to the supplied parameters.static boolean
Launch call intent for the supplied number.static boolean
copyToClipboard
(Context context, String label, String text) Copy a plain text to the clipboard.static boolean
email
(Context context, String[] emails, String[] ccEmails, String[] bccEmails, String subject, String text) Send email according to the supplied parameters.static boolean
Send email according to the supplied parameters.static boolean
Send email according to the supplied parameters.static boolean
Ask questions or submit bug report to the developer via Google feedback.static boolean
feedback
(Context context, String appName, String email, int reportType, ApplicationErrorReport.CrashInfo crashInfo) Ask questions or submit bug report to the developer via Google feedback.static boolean
geoLocation
(Context context, String latitude, String longitude) Try to view location URL according to the supplied parameters.static boolean
Try to view location URL according to the supplied parameters.static boolean
isEmailExists
(Context context) Checks whether the email client exists on the device.static boolean
isFeedbackExists
(Context context) Checks whether the feedback functionality exists on the device.static boolean
isGMSExists
(Context context) Checks whether the GMS (Google Mobile Services) package exists on the device.static boolean
isGoogleFeedbackExists
(Context context) Checks whether the Google feedback package exists on the device.static boolean
View other apps of a Publisher on Google Play or Android Market.static boolean
moreAppsSamsung
(Context context, String publisher) View other apps of a Samsung Galaxy Store.static boolean
View app on Google Play or Android Market.static boolean
View app on Google Play or Android Market.static boolean
Ask questions or submit bug report to the developer via email.static boolean
Ask questions or submit bug report to the developer via email.static boolean
Share application via system default share intent so that user can select from the available apps if more than one apps are available.static boolean
Share application via system default share intent so that user can select from the available apps if more than one apps are available.static boolean
Share application via system default share intent so that user can select from the available apps if more than one apps are available.static boolean
Share application via system default share intent so that user can select from the available apps if more than one apps are available.static boolean
Share application via system default share intent so that user can select from the available apps if more than one apps are available.static boolean
Share application via system default share intent so that user can select from the available apps if more than one apps are available.static boolean
Share application via system default share intent so that user can select from the available apps if more than one apps are available.static boolean
Launch SMS or MMS intent according to the supplied parameters.static boolean
View app on Google Play (or Android Market) or Samsung Galaxy Store if available.static boolean
View app on Google Play (or Android Market) or Samsung Galaxy Store if available.static boolean
viewAppExternal
(Context context, String packageName) View app on Google Play (or Android Market) or Samsung Galaxy Store if available.static boolean
viewInGooglePlay
(Context context, String packageName) View app on Google Play or Android Market.static boolean
viewInSamsungGalaxyStore
(Context context, String packageName) View app on Samsung Galaxy Store.static boolean
View any URL in the available app or browser.
-
Constructor Details
-
DynamicLinkUtils
public DynamicLinkUtils()
-
-
Method Details
-
copyToClipboard
public static boolean copyToClipboard(@NonNull Context context, @NonNull String label, @NonNull String text) Copy a plain text to the clipboard.- Parameters:
context
- The context to get the clipboard manager.label
- The user visible label for the clip data.text
- The actual text in the clip.- Returns:
true
if copied to clipboard successfully.- See Also:
-
viewUrl
View any URL in the available app or browser. Some URLs will automatically open in their respective apps if installed on the device. Special treatment is applied for the Facebook URLs to open them directly in the app.Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.url
- The web or app link to open.- Returns:
true
on successful operation.- See Also:
-
viewInGooglePlay
View app on Google Play or Android Market.Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.packageName
- The app package name to build the search query.- Returns:
true
on successful operation.- See Also:
-
viewInSamsungGalaxyStore
public static boolean viewInSamsungGalaxyStore(@Nullable Context context, @NonNull String packageName) View app on Samsung Galaxy Store.Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.packageName
- The app package name to build the search query.- Returns:
true
on successful operation.- See Also:
-
viewApp
public static boolean viewApp(@Nullable Context context, @NonNull String packageName, String flavor) View app on Google Play (or Android Market) or Samsung Galaxy Store if available.Can be used to view app details within the supported stores.
Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.packageName
- The app package name to build the search query.flavor
- The product flavor to be used.- Returns:
true
on successful operation.- See Also:
-
viewApp
View app on Google Play (or Android Market) or Samsung Galaxy Store if available.Can be used to view app details within the supported stores.
Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.packageName
- The app package name to build the search query.- Returns:
true
on successful operation.- See Also:
-
viewAppExternal
View app on Google Play (or Android Market) or Samsung Galaxy Store if available. External stores will be preferred first.Can be used to view app details within the supported stores.
Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.packageName
- The app package name to build the search query.- Returns:
true
on successful operation.- See Also:
-
rateApp
View app on Google Play or Android Market.Can be used for the quick feedback or rating from the user.
Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.flavor
- The product flavor to be used.- Returns:
true
on successful operation.- See Also:
-
rateApp
View app on Google Play or Android Market.Can be used for the quick feedback or rating from the user.
Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.- Returns:
true
on successful operation.- See Also:
-
moreApps
View other apps of a Publisher on Google Play or Android Market.Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.publisher
- The publisher name to build the search query.- Returns:
true
on successful operation.- See Also:
-
moreAppsSamsung
View other apps of a Samsung Galaxy Store.Use
queries
tag forIntent.ACTION_VIEW
with schemehttps or http
inAndroidManifest
to support API 30.- Parameters:
context
- The context to be used.publisher
- The publisher name to build the search query.- Returns:
true
on successful operation.- See Also:
-
email
public static boolean email(@Nullable Context context, @Nullable String[] emails, @Nullable String[] ccEmails, @Nullable String[] bccEmails, @Nullable String subject, @Nullable String text) Send email according to the supplied parameters.- Parameters:
context
- The context to be used.emails
- The email ids to be used.ccEmails
- The cc email ids to be used.bccEmails
- The bcc email ids to be used.subject
- The optional email subject.text
- The optional email text.- Returns:
true
on successful operation.- See Also:
-
email
public static boolean email(@Nullable Context context, @Nullable String[] emails, @Nullable String subject, @Nullable String text) Send email according to the supplied parameters.- Parameters:
context
- The context to be used.emails
- The email ids to be used.subject
- The optional email subject.text
- The optional email text.- Returns:
true
on successful operation.- See Also:
-
email
public static boolean email(@Nullable Context context, @Nullable String email, @Nullable String subject, @Nullable String text) Send email according to the supplied parameters.- Parameters:
context
- The context to be used.email
- The email ids to be used.subject
- The optional email subject.text
- The optional email text.- Returns:
true
on successful operation.- See Also:
-
report
public static boolean report(@Nullable Context context, @Nullable String appName, @Nullable String email, Boolean license) Ask questions or submit bug report to the developer via email.Subject of the email will be generated automatically by detecting the manufacturer, device, Android version and the app version along with the supplied app name.
- Parameters:
context
- The context to be used.appName
- The app name for the email subject.null
to get it from the supplied context.email
- The email id of the developer.license
-true
if the license is available on the devices.- Returns:
true
on successful operation.- See Also:
-
report
public static boolean report(@Nullable Context context, @Nullable String appName, @NonNull String email) Ask questions or submit bug report to the developer via email.Subject of the email will be generated automatically by detecting the manufacturer, device, Android version and the app version along with the supplied app name.
- Parameters:
context
- The context to be used.appName
- The app name for the email subject.null
to get it from the supplied context.email
- The email id of the developer.- Returns:
true
on successful operation.- See Also:
-
isEmailExists
Checks whether the email client exists on the device.Use
queries
tag forIntent.ACTION_SENDTO
with schemeMailTo.MAILTO_SCHEME
inAndroidManifest
to support API 30.- Parameters:
context
- The context to get the package manager.- Returns:
true
if the email client exists on the device.
-
isGMSExists
Checks whether the GMS (Google Mobile Services) package exists on the device.- Parameters:
context
- The context to get the package manager.- Returns:
true
if the GMS (Google Mobile Services) package exists on the device.
-
isGoogleFeedbackExists
Checks whether the Google feedback package exists on the device.- Parameters:
context
- The context to get the package manager.- Returns:
true
if the Google feedback package exists on the device.
-
isFeedbackExists
Checks whether the feedback functionality exists on the device.- Parameters:
context
- The context to get the package manager.- Returns:
true
if the feedback functionality exists on the device.- See Also:
-
feedback
public static boolean feedback(@Nullable Context context, @Nullable String appName, @NonNull String email, int reportType, @Nullable ApplicationErrorReport.CrashInfo crashInfo) Ask questions or submit bug report to the developer via Google feedback.It will redirect to
report(Context, String, String)
method if feedback package is not available on the device.- Parameters:
context
- The context to be used.appName
- The app name for the email subject.null
to get it from the supplied context.email
- The email id of the developer.reportType
- The crash report type.Can be one of
ApplicationErrorReport.TYPE_NONE
,ApplicationErrorReport.TYPE_CRASH
,ApplicationErrorReport.TYPE_ANR
,ApplicationErrorReport.TYPE_BATTERY
, orApplicationErrorReport.TYPE_RUNNING_SERVICE
.crashInfo
- The crash info for the report.- Returns:
true
on successful operation.- See Also:
-
feedback
public static boolean feedback(@Nullable Context context, @Nullable String appName, @NonNull String email) Ask questions or submit bug report to the developer via Google feedback.It will redirect to
report(Context, String, String)
method if feedback package is not available on the device.- Parameters:
context
- The context to be used.appName
- The app name for the email subject.null
to get it from the supplied context.email
- The email id of the developer.- Returns:
true
on successful operation.- See Also:
-
bookmark
public static boolean bookmark(@Nullable Context context, @Nullable String url, @Nullable String title) View or bookmark URL according to the supplied parameters.- Parameters:
context
- The context to be used.url
- The URL to be used.title
- The optional title to launch the bookmark intent.- Returns:
true
on successful operation.- See Also:
-
call
Launch call intent for the supplied number.- Parameters:
context
- The context to be used.number
- The number to be called.- Returns:
true
on successful operation.- See Also:
-
smsOrMms
public static boolean smsOrMms(@Nullable Context context, @Nullable String[] numbers, @Nullable String subject, @Nullable String text) Launch SMS or MMS intent according to the supplied parameters.- Parameters:
context
- The context to be used.numbers
- The numbers to be used.subject
- The optional subject if MMS.text
- The body text to be used.- Returns:
true
on successful operation.- See Also:
-
geoLocation
public static boolean geoLocation(@Nullable Context context, @Nullable String latitude, @Nullable String longitude, @Nullable String altitude, @Nullable String query) Try to view location URL according to the supplied parameters.- Parameters:
context
- The context to be used.latitude
- The latitude to be used.longitude
- The longitude to be used.altitude
- The optional altitude to be used.query
- The optional custom query to be used.- Returns:
true
on successful operation.- See Also:
-
geoLocation
public static boolean geoLocation(@Nullable Context context, @Nullable String latitude, @Nullable String longitude) Try to view location URL according to the supplied parameters.- Parameters:
context
- The context to be used.latitude
- The latitude to be used.longitude
- The longitude to be used.- Returns:
true
on successful operation.- See Also:
-
addContact
public static boolean addContact(@Nullable Context context, @Nullable String[] names, @Nullable String[] nicknames, @Nullable String pronunciation, @Nullable String[] phones, @Nullable String[] phoneTypes, @Nullable String[] emails, @Nullable String[] emailTypes, @Nullable String[] addresses, @Nullable String[] addressTypes, @Nullable String birthday, @Nullable String title, @Nullable String organization, @Nullable String[] websites, @Nullable String note) Launch add contact intent according to the supplied parameters.- Parameters:
context
- The context to be used.names
- The names to be used.nicknames
- The nicknames to be used.pronunciation
- The pronunciation to be used.phones
- The phones to be used.phoneTypes
- The phone types to be used.emails
- The emails to be used.emailTypes
- The email types to be used.addresses
- The addresses to be used.addressTypes
- The address types to be used.birthday
- The birthday to be used.organization
- The organization to be used.title
- The title to be used.websites
- The websites to be used.note
- The note to be used.- Returns:
true
on successful operation.- See Also:
-
addEvent
public static boolean addEvent(@Nullable Context context, @Nullable String title, long startTime, long endTime, boolean allDay, @Nullable String organizer, @Nullable String location, @Nullable String description) Launch add calendar event intent according to the supplied parameters.- Parameters:
context
- The context to be used.title
- The title (summary) to be used.startTime
- The start time to be used.endTime
- The end time to be used.allDay
-true
if the event is all day.organizer
- The organizer tobe used.location
- The location to be used.description
- The description to be used.- Returns:
true
on successful operation.- See Also:
-