Adding New App Details (Android)
Upon installing SDK, you must add your app via the Dropthought mobile app.
Follow the below steps to add a new app:
Navigate to your Profile on the Dropthought mobile app.
Click on Manage Native SDK.
Click on Manage Applications. The section will be empty if you do not have any apps added.
If you have already added any apps earlier, they will be displayed on this screen.
Click on Browse and upload an app icon.
Enter the App Name and Version Name (optional).
Click on Add new visibility.
In the following screen, you will be prompted to enter the page name and element name that should redirect the user to the linked program.
This information will help you to easily identify which element (widget, for instance) on your app is connected to a visibility ID. You can edit the page name and element name anytime.Once you add a page and element name for later reference, click on Add Visibility.
This will give you a unique ID you must insert in the code snippet to be added to your app. This unique ID cannot be edited as it will be used to uniquely identify the element of your app where Dropthought will collect feedback.
Open Program
Use the following snippet to open the Dropthought survey based on an action performed by a user on your app.
Copy the visibility ID and paste it into the code snippet below, replacing YOUR_VISIBILITY_ID.
Pre-requisite: DeclareDropthought.openSurveyActivity(Activity activity, String visibilityId)
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Dropthought.init(...)
Button button = findViewById(R.id.btn_open_survey);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// This is how you display a survey for the user to take
// Remember: you must supply the activity (e.g. this)
+ Dropthought.openSurveyActivity(
+ this,
+ YOUR_VISIBILITY_ID
+ );
}
});
}
/*...*/
}
Set Program Metadata
Use the below APIs to capture metadata from the responses received.
Dropthought.setSurveyMetadata(Bundle metadata)
Bundle metadata = new Bundle();
metadata.putString("name", "Barney");
metadata.putString("age", "36");
Dropthought.setSurveyMetadata(metadata);
Learn more: Associate a Program to an Android App
