Small manager that allows to create feedback email intents
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/main
.gitignore
LICENSE
README.md
build.gradle
proguard-rules.pro

README.md

FeedbackManager Release

What is it / What does it do?

This is a very small library that allows you to send feedback from an app without internet connection via email, either directly or via an unintrusive notification. It only has 63 methods and one dependency (com.android.support:support-core-ui, necessary for the notification)

Gradle (via JitPack.io)

  1. add jitpack to your project's build.gradle:
repositories {
	maven { url "https://jitpack.io" }
}
  1. add the compile statement to your module's build.gradle:
dependencies {
	compile 'com.github.MFlisar:FeedbackManager:1.3'
}

Usage - General

  1. Create a builder
File file = ...;
FeedbackBuilder builder = FeedbackBuilder.create()
	// required!
	.addReceiver("admin@example.com")
	// following things are optional
	.withSubject("Feedback for My App v1.0")
	.withText("My email text...")
	.addFile(file); // files will be copied to the apps cache and provided via a simple cache file provider
  1. Adding files - customise behaviour

Files are exposed via a ContentProvider that copies the file to the app's cache directory. You can add files in those ways:

File file = ...;
Uri fileUri = ...;
builder
        // 1) copy file to cache and use the original file name
	.addFile(file)
	.addFile(fileUri)
	.addFile(new FeedbackFile(file))
	.addFile(new FeedbackFile(fileUri))
	// 2) copy file to cache and use custom file name
	.addFile(new FeedbackFile(file).withCustomCacheFileName("my_file_name.txt"))
	.addFile(new FeedbackFile(fileUri).withCustomCacheFileName("my_second_file_name.txt"))
	// 3) copy file to cache and generate a unique name (uses the oringal name and adds a "_" + UUID before the file extension) 
	.addFile(new FeedbackFile(file).withGenerateUniqueName())
	.addFile(new FeedbackFile(fileUri).withGenerateUniqueName())
  1. Send the feedback mail
String notificationChannel = ...;
int notificationId = ...;
int notificationIcon = ...;

// Variation 1:
// Show a notification, it can be clicked and then the user can select how he wants to send the feedback mail
builder.startNotification(context, 
	"Title of the email chooser dialog", 
	"Notification Title", 
	"Notification Text", 
	notificationIcon, 
	notificationChannel, 
	notificationId);

// Variation 2:
// Directly start the email chooser
builder.startEmailChooser(context, "Title of the email chooser dialog");

// Variation 3:
// get the intent that can be started whenever desired
Intent emailIntent = builder.buildIntent(context, "Title of the email chooser dialog");