Class DynamicLinkUtils
- java.lang.Object
-
- com.pranavpandey.android.dynamic.util.DynamicLinkUtils
-
public class DynamicLinkUtils extends java.lang.ObjectHelper class to perform URL, email and feedback related operations.
-
-
Constructor Summary
Constructors Constructor Description DynamicLinkUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancopyToClipboard(android.content.Context context, java.lang.String label, java.lang.String text)Copy a plain text to the clipboard.static booleanemail(android.content.Context context, java.lang.String[] emails, java.lang.String subject, java.lang.String text)Ask questions or submit bug report to the developer via email.static booleanemail(android.content.Context context, java.lang.String email, java.lang.String subject, java.lang.String text)Ask questions or submit bug report to the developer via email.static booleanfeedback(android.content.Context context, java.lang.String appName, java.lang.String email)Ask questions or submit bug report to the developer via Google feedback.static booleanfeedback(android.content.Context context, java.lang.String appName, java.lang.String email, int reportType, android.app.ApplicationErrorReport.CrashInfo crashInfo)Ask questions or submit bug report to the developer via Google feedback.static booleanisEmailExists(android.content.Context context)Checks whether the email client exists on the device.static booleanisFeedbackExists(android.content.Context context)Checks whether the feedback functionality exists on the device.static booleanisGMSExists(android.content.Context context)Checks whether the GMS (Google Mobile Services) package exists on the device.static booleanisGoogleFeedbackExists(android.content.Context context)Checks whether the Google feedback package exists on the device.static booleanmoreApps(android.content.Context context, java.lang.String publisher)View other apps of a Publisher on Google Play or Android Market.static booleanrateApp(android.content.Context context)View app on Google Play or Android Market.static booleanreport(android.content.Context context, java.lang.String appName, java.lang.String email)Ask questions or submit bug report to the developer via email.static booleanreport(android.content.Context context, java.lang.String appName, java.lang.String email, java.lang.Boolean license)Ask questions or submit bug report to the developer via email.static booleanshare(android.content.Context context, java.lang.String title, java.lang.String message)Share application via system default share intent so that user can select from the available apps if more than one apps are available.static booleanshare(android.content.Context context, java.lang.String title, java.lang.String message, android.net.Uri image)Share application via system default share intent so that user can select from the available apps if more than one apps are available.static booleanshare(android.content.Context context, java.lang.String title, java.lang.String message, android.net.Uri uri, java.lang.String mimeType)Share application via system default share intent so that user can select from the available apps if more than one apps are available.static booleanshareApp(android.content.Context context)Share application via system default share intent so that user can select from the available apps if more than one apps are available.static booleanviewInGooglePlay(android.content.Context context, java.lang.String packageName)View app on Google Play or Android Market.static booleanviewUrl(android.content.Context context, java.lang.String url)View any URL in the available app or browser.
-
-
-
Method Detail
-
copyToClipboard
public static boolean copyToClipboard(@NonNull android.content.Context context, @NonNull java.lang.String label, @NonNull java.lang.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:
trueif copied to clipboard successfully.- See Also:
ClipboardManager
-
share
public static boolean share(@Nullable android.content.Context context, @Nullable java.lang.String title, @Nullable java.lang.String message, @Nullable android.net.Uri uri, @Nullable java.lang.String mimeType)Share application via system default share intent so that user can select from the available apps if more than one apps are available.- Parameters:
context- The context to retrieve the resources.title- The application chooser title if more than one apps are available.message- The default share message which user can modify.nullto supply app and package name.uri- The optional content URI to be shared.mimeType- The optional mime type for the file.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_SEND
-
share
public static boolean share(@Nullable android.content.Context context, @Nullable java.lang.String title, @Nullable java.lang.String message, @Nullable android.net.Uri image)Share application via system default share intent so that user can select from the available apps if more than one apps are available.- Parameters:
context- The context to retrieve the resources.title- The application chooser title if more than one apps are available.message- The default share message which user can modify.nullto supply app and package name.image- The optional image bitmap URI to be shared.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_SEND
-
share
public static boolean share(@Nullable android.content.Context context, @Nullable java.lang.String title, @Nullable java.lang.String message)Share application via system default share intent so that user can select from the available apps if more than one apps are available.- Parameters:
context- The context to retrieve the resources.title- The application chooser title if more than one apps are available.message- The default share message which user can modify.nullto supply app and package name.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_SEND
-
shareApp
public static boolean shareApp(@Nullable android.content.Context context)Share application via system default share intent so that user can select from the available apps if more than one apps are available.- Parameters:
context- The context to retrieve the resources.- Returns:
trueon successful operation.- See Also:
share(Context, String, String)
-
viewUrl
public static boolean viewUrl(@Nullable android.content.Context context, @Nullable java.lang.String url)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
queriestag forIntent.ACTION_VIEWwith schemehttps or httpinAndroidManifestto support API 30.- Parameters:
context- The context to retrieve the resources.url- The web or app link to open.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_VIEW
-
viewInGooglePlay
public static boolean viewInGooglePlay(@Nullable android.content.Context context, @NonNull java.lang.String packageName)View app on Google Play or Android Market.Use
queriestag forIntent.ACTION_VIEWwith schemehttps or httpinAndroidManifestto support API 30.- Parameters:
context- The context to retrieve the resources.packageName- Application package name to build the search query.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_VIEW
-
rateApp
public static boolean rateApp(@Nullable android.content.Context context)View app on Google Play or Android Market.Can be used for the quick feedback or rating from the user.
Use
queriestag forIntent.ACTION_VIEWwith schemehttps or httpinAndroidManifestto support API 30.- Parameters:
context- The context to retrieve the resources.- Returns:
trueon successful operation.- See Also:
viewInGooglePlay(Context, String)
-
moreApps
public static boolean moreApps(@Nullable android.content.Context context, @NonNull java.lang.String publisher)View other apps of a Publisher on Google Play or Android Market.Use
queriestag forIntent.ACTION_VIEWwith schemehttps or httpinAndroidManifestto support API 30.- Parameters:
context- The context to retrieve the resources.publisher- The publisher name to build the search query.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_VIEW
-
email
public static boolean email(@Nullable android.content.Context context, @NonNull java.lang.String[] emails, @Nullable java.lang.String subject, @Nullable java.lang.String text)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 retrieve the resources.emails- The email ids of the developer.subject- The optional email subject.text- The optional email text.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_SENDTO,MailTo.MAILTO_SCHEME
-
email
public static boolean email(@Nullable android.content.Context context, @NonNull java.lang.String email, @Nullable java.lang.String subject, @Nullable java.lang.String text)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 retrieve the resources.email- The email id of the developer.subject- The optional email subject.text- The optional email text.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_SENDTO,MailTo.MAILTO_SCHEME
-
report
public static boolean report(@Nullable android.content.Context context, @Nullable java.lang.String appName, @NonNull java.lang.String email, java.lang.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 retrieve the resources.appName- The app name for the email subject.nullto get it from the supplied context.email- The email id of the developer.license-trueif the license is available on the devices.- Returns:
trueon successful operation.- See Also:
Intent.ACTION_SENDTO,MailTo.MAILTO_SCHEME
-
report
public static boolean report(@Nullable android.content.Context context, @Nullable java.lang.String appName, @NonNull java.lang.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 retrieve the resources.appName- The app name for the email subject.nullto get it from the supplied context.email- The email id of the developer.- Returns:
trueon successful operation.- See Also:
report(Context, String, String, Boolean)
-
isEmailExists
public static boolean isEmailExists(@Nullable android.content.Context context)Checks whether the email client exists on the device.Use
queriestag forIntent.ACTION_SENDTOwith schemeMailTo.MAILTO_SCHEMEinAndroidManifestto support API 30.- Parameters:
context- The context to get the package manager.- Returns:
trueif the email client exists on the device.
-
isGMSExists
public static boolean isGMSExists(@Nullable android.content.Context context)Checks whether the GMS (Google Mobile Services) package exists on the device.- Parameters:
context- The context to get the package manager.- Returns:
trueif the GMS (Google Mobile Services) package exists on the device.
-
isGoogleFeedbackExists
public static boolean isGoogleFeedbackExists(@Nullable android.content.Context context)Checks whether the Google feedback package exists on the device.- Parameters:
context- The context to get the package manager.- Returns:
trueif the Google feedback package exists on the device.
-
isFeedbackExists
public static boolean isFeedbackExists(@Nullable android.content.Context context)Checks whether the feedback functionality exists on the device.- Parameters:
context- The context to get the package manager.- Returns:
trueif the feedback functionality exists on the device.- See Also:
isGMSExists(Context),isGoogleFeedbackExists(Context)
-
feedback
public static boolean feedback(@Nullable android.content.Context context, @Nullable java.lang.String appName, @NonNull java.lang.String email, int reportType, @Nullable android.app.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 retrieve the resources.appName- The app name for the email subject.nullto 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:
trueon successful operation.- See Also:
ApplicationErrorReport
-
feedback
public static boolean feedback(@Nullable android.content.Context context, @Nullable java.lang.String appName, @NonNull java.lang.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 retrieve the resources.appName- The app name for the email subject.nullto get it from the supplied context.email- The email id of the developer.- Returns:
trueon successful operation.- See Also:
ApplicationErrorReport,ApplicationErrorReport.TYPE_NONE
-
-