📜 ⬆️ ⬇️

We build in polls for users of Android applications

Hi, Habr!

One of the main tasks facing developers after the release is to get feedback from users in order to improve and develop applications. Infrequently, similar information can be obtained from reviews on Google Play, and not all users devote their time to this, even if they have any ideas. If the developer considers it necessary to receive feedback, he can implement the corresponding functionality in his application on his own, which entails a number of relevant costs.

Under the cut I want to tell you about the cool “bun” called Profit Button, which will help establish a dialogue with the users of your application, as well as expand its functionality as you wish.
')


Profit button - an element represented as a floating button, located on top of the interface of your application. When you tap a button, the user opens a WebView window with a poll, which is visible to all users.



For developers




How to create a poll?


Creating a survey consists of five simple steps:

  1. Create questions and specify answer options
  2. We describe the logic of transitions between questions.
  3. Specify what users will see upon completion of the survey
  4. Revitalize the look, using one of the proposed styles
  5. We establish a link between the survey and the project of your application


Integration with Android application


  1. Download the project from the repository
  2. Add the ProButton.jar library to the project dependency list
  3. Add the necessary permissions to the manifest file:
    <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
  4. For Android 4.xx devices, you need to add just one line of code to the main Activity's onCreate method:
     ProBtn.open(this); 

    If you need to support devices with older versions of Android on board, you also need to change the code for each Activity as follows:
     @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (android.os.Build.VERSION.SDK_INT < 11) { ProBtn.onActivityCreated(); } } @Override protected void onResume() { super.onResume(); if (android.os.Build.VERSION.SDK_INT < 11) { ProBtn.onActivityResumed(this); } } @Override protected void onPause() { if (android.os.Build.VERSION.SDK_INT < 11) { ProBtn.onActivityPaused(); } super.onPause(); } @Override protected void onDestroy() { if (android.os.Build.VERSION.SDK_INT < 11) { ProBtn.onActivityDestroyed(this); } super.onDestroy(); } 

Profit Button can be hidden / shown directly from the application code using the methods ProBtn.showProBtn () and ProBtn.hideProBtn () .

You can get these usage statistics directly from the code:
 ProBtn.getUsageStatistics(new ProBtn.ProButtonStatisticsCallback() { @Override public void done(JSONObject jsonObject, Exception e) { ... } }); 


Links


Source: https://habr.com/ru/post/206218/


All Articles