Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This was solved with the help from the link in @TomTasche comment above. <a href="http://blog.tomtasche.at/2012/10/use-built-in-feedback-mechanism-on.html" rel="nofollow noreferrer">Use built-in feedback mechanism on Android</a>.</p> <p>In my <code>AndroidManifest.xml</code> I added the following to the <code>&lt;Activity&gt;</code> where I want to call the Feedback agent from.</p> <pre><code>&lt;intent-filter&gt; &lt;action android:name="android.intent.action.APP_ERROR" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; </code></pre> <p>And I made a simple method called <code>sendFeedback()</code> (code from TomTasche blogpost)</p> <pre><code>@SuppressWarnings("unused") @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void sendFeedback() { try { int i = 3 / 0; } catch (Exception e) { ApplicationErrorReport report = new ApplicationErrorReport(); report.packageName = report.processName = getApplication().getPackageName(); report.time = System.currentTimeMillis(); report.type = ApplicationErrorReport.TYPE_CRASH; report.systemApp = false; ApplicationErrorReport.CrashInfo crash = new ApplicationErrorReport.CrashInfo(); crash.exceptionClassName = e.getClass().getSimpleName(); crash.exceptionMessage = e.getMessage(); StringWriter writer = new StringWriter(); PrintWriter printer = new PrintWriter(writer); e.printStackTrace(printer); crash.stackTrace = writer.toString(); StackTraceElement stack = e.getStackTrace()[0]; crash.throwClassName = stack.getClassName(); crash.throwFileName = stack.getFileName(); crash.throwLineNumber = stack.getLineNumber(); crash.throwMethodName = stack.getMethodName(); report.crashInfo = crash; Intent intent = new Intent(Intent.ACTION_APP_ERROR); intent.putExtra(Intent.EXTRA_BUG_REPORT, report); startActivity(intent); } } </code></pre> <p>And from my <code>SettingsActivity</code> I call it like:</p> <pre><code> findPreference(sFeedbackKey).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { public final boolean onPreferenceClick(Preference paramAnonymousPreference) { sendFeedback(); finish(); return true; } }); </code></pre> <h2>Verified working with Android <strong>2.3.7</strong> and <strong>4.2.2</strong>.</h2> <p>When the <code>sendFeedback()</code> method is called, a "Complete action using"-dialog is opened where the user can select from three actions/icons.</p> <p><img src="https://i.stack.imgur.com/nTF1f.png" alt="Complete action using"></p> <p>The calling app, which returns to the app, and Google Play and the Feedback agent. Selecting either <code>Google Play Store</code>or <code>Send feedback</code> will open the built-in Android feedback agent as intended.</p> <p><img src="https://i.stack.imgur.com/yYb1w.png" alt="Send feedback"></p> <p>I haven't investigated further if it's possible to skip the "Complete action using"-step, it's probably possible with the correct parameters passed to the <code>Intent</code>. So far, this does exactly what I wanted for now.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload