Add below dependency in app level build.gradle file
implementation 'com.mappls.sdk:feedback-ui:3.0.1'
Add your API keys to the SDK (in your application's onCreate() or before using map)
MapplsAccountManager.getInstance().setRestAPIKey(getRestAPIKey());
MapplsAccountManager.getInstance().setMapSDKKey(getMapSDKKey());
MapplsAccountManager.getInstance().setAtlasClientId(getAtlasClientId());
MapplsAccountManager.getInstance().setAtlasClientSecret(getAtlasClientSecret());
MapplsAccountManager.getInstance().restAPIKey = getRestAPIKey()
MapplsAccountManager.getInstance().mapSDKKey = getMapSDKKey()
MapplsAccountManager.getInstance().atlasClientId = getAtlasClientId()
MapplsAccountManager.getInstance().atlasClientSecret = getAtlasClientSecret()
There are two ways to implement Feedback UI
widget:
- Using
FeedbackFragment
- Using
FeedbackActivity
Add FeedbackFragment in your activity
FeedbackOptions feedbackOption =FeedbackOptions.builder()
.latitude(<Latitude>)
.longitude(<Longitude>)
.build();
FeedbackFragment feedbackFragment = FeedbackFragment.newInstance(feedbackOption);
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, feedbackFragment, FeedbackFragment.class.getSimpleName())
.commit();
val feedbackOption: FeedbackOptions = FeedbackOptions.builder()
.latitude(< Latitude >)
.longitude(< Longitude >)
.build()
val feedbackFragment: FeedbackFragment = FeedbackFragment.newInstance(feedbackOption)
supportFragmentManager.beginTransaction().add(R.id.fragment_container, feedbackFragment, FeedbackFragment::class.java.simpleName)
.commit()
To get the event of Report Submit use FeedbackCallback
interface:
feedbackFragment.setFeedbackCallback(new FeedbackCallback() {
@Override
public void onSubmittedReport() {
// On Submitted Report Succssfully
}
@Override
public void onCancel() {
//on click of Cancel button
}
});
feedbackFragment.setFeedbackCallback(object : FeedbackCallback {
override fun onCancel() {
//on click of Cancel button
}
override fun onSubmittedReport() {
// On Submitted Report Succssfully
}
})
Add FeedbackActivity in your activity:
FeedbackOptions builder=FeedbackOptions.builder()
.placeName(<name of place>)
.latitude(<Latitude>)
.longitude(<Longitude>)
.build();
Intent intent = new MapplsFeedback.IntentBuilder().feedbackOptions(feedbackOptions)
.build(this);
startActivityForResult(intent, REQUEST_CODE);
val builder: FeedbackOptions = FeedbackOptions.builder()
.placeName(< name of place >)
.latitude(< Latitude >)
.longitude(< Longitude >)
.build()
val intent = MapplsFeedback.IntentBuilder().feedbackOptions(feedbackOptions)
.build(this);
startActivityForResult(intent, REQUEST_CODE);
To get the event of Report Submit:
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == REQUEST_CODE) {
if(resultCode == Activity.RESULT_OK) {
//Report Submit Successfully
}
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(requestCode == REQUEST_CODE) {
if(resultCode == Activity.RESULT_OK) {
//Report Submit Successfully
}
}
}
You can use FeedbackOptions
to set the properties of the widget:
mapplsPin(string)
: Mappls Pin of the place.The 6-digit alphanumeric code for any location.latitude(Double)
: Latitude of the user’s location.longitude(Double)
: longitude of the user’s location. ** Either the eloc or latitude & Longitude will be served. **
placeName(string)
: Name of the place where the event is taking place. It should be derived on the basis of Mappls Pin and coordinates.theme(Integer)
: To change the theme of the UI. Below are the available value:- FeedbackOptions.THEME_DAY (Default)
- FeedbackOptions.THEME_NIGHT
showStepProgress(boolean)
: To show/hide Circular Progress of stepsshowCompletedProgress(boolean)
: To show/hide Completed Progress textutc(Long)
: Date time in unix timestamp format.flag(Integer)
: If navroute is active then 1 else 0.expiry(Long)
: Date time in unix timestamp format to set expiry for the report.accuracy(Integer)
: Accuracy of user's location.altitude(Double)
: Altitude of the user’s location, in meters.bearing(Integer)
: Bearing of the user’s location, in degrees.quality(String)
: Quality of user's location.speed(String)
: User's speed in kilometers.
You need to define the Custom Styles in styles.xml or themes.xml
For Day Theme
<style name="CustomFeedbackDay" parent="MapplsFeedbackLight">
<item name="mapplsFeedbackToolbarSeperatorColor">#FFFFFF</item>
</style>
For Dark Theme
<style name="CustomFeedbackNight" parent="MapplsFeedbackNight">
<item name="mapplsFeedbackToolbarSeperatorColor">#000000</item>
</style>
To set custom style in FeedbackOption:
FeedbackOptions feedbackOptions = FeedbackOptions.builder()
.dayTheme(R.style.CustomFeedbackDay)
.darkTheme(R.style.CustomFeedbackNight)
.build();
mapplsFeedbackToolbarBackground(color)
: To change the color of Toolbar BackgroundmapplsFeedbackToolbarTextColor(color)
: To change the color of Toolbar TextmapplsFeedbackToolbarSeperatorColor(color)
: To change the Toolbar Seperator colormapplsFeedbackBackground(color)
: To change the Background color of Feedback ScreenmapplsFeedbackStepsHeaderBackground(color)
: To change the Steps view Background colormapplsFeedbackStepsTextColor(color)
: To change the Steps text colormapplsFeedbackFooterBackground(color)
: To change Footer background colormapplsFeedbackBackBtnBackground(reference)
: To change Back button backgroundmapplsFeedbackBackBtnTextColor(color)
: To change Back button text colormapplsFeedbackSubmitBtnBackground(reference)
: To change Submit Button BackgroundmapplsFeedbackSubmitBtnTextColor(color)
: To change Submit Button Text color
For any queries and support, please contact:
Email us at apisupport@mappls.comSupport Need support? contact us!