From 37dea130258ec04434f5fe1c853cb85168dde53a Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Mon, 7 Feb 2022 09:56:16 +0530 Subject: [PATCH] Add device info in crash screen --- .../yogeshpaliyal/keypass/ui/CrashActivity.kt | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/yogeshpaliyal/keypass/ui/CrashActivity.kt b/app/src/main/java/com/yogeshpaliyal/keypass/ui/CrashActivity.kt index d56bcc15..57a62d44 100644 --- a/app/src/main/java/com/yogeshpaliyal/keypass/ui/CrashActivity.kt +++ b/app/src/main/java/com/yogeshpaliyal/keypass/ui/CrashActivity.kt @@ -3,10 +3,13 @@ package com.yogeshpaliyal.keypass.ui import android.content.Context import android.content.Intent import android.net.Uri +import android.os.Build import android.os.Bundle import androidx.appcompat.app.AppCompatActivity +import com.yogeshpaliyal.keypass.BuildConfig import com.yogeshpaliyal.keypass.databinding.ActivityCrashBinding import dagger.hilt.android.AndroidEntryPoint +import java.lang.StringBuilder @AndroidEntryPoint class CrashActivity : AppCompatActivity() { @@ -31,12 +34,30 @@ class CrashActivity : AppCompatActivity() { binding.txtCrash.text = intent.extras?.getString(ARG_DATA) binding.btnSendFeedback.setOnClickListener { + + val deviceInfo = StringBuilder() + try { + deviceInfo.append("\n") + deviceInfo.append("App Version: " + BuildConfig.VERSION_NAME) + deviceInfo.append("\n") + deviceInfo.append("Brand Name: " + Build.BRAND) + deviceInfo.append("\n") + deviceInfo.append("Manufacturer Name: " + Build.MANUFACTURER) + deviceInfo.append("\n") + deviceInfo.append("Device Name: " + Build.MODEL) + deviceInfo.append("\n") + deviceInfo.append("Device API Version: " + Build.VERSION.SDK_INT) + deviceInfo.append("\n") + }catch (e:Exception){ + e.printStackTrace() + } + val intent = Intent(Intent.ACTION_SENDTO) intent.data = Uri.parse("mailto:") intent.putExtra(Intent.EXTRA_EMAIL, arrayOf("yogeshpaliyal.foss@gmail.com")) intent.putExtra(Intent.EXTRA_SUBJECT, "Crash Report in KeyPass") - intent.putExtra(Intent.EXTRA_TEXT, binding.txtCrash.text.toString()) + intent.putExtra(Intent.EXTRA_TEXT, binding.txtCrash.text.toString() + "$deviceInfo") startActivity(Intent.createChooser(intent, "")) }