mirror of
https://github.com/yogeshpaliyal/KeyPass.git
synced 2026-01-09 16:36:08 -06:00
Add device info in crash screen
This commit is contained in:
@@ -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, ""))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user