0

I am new to android development and Kotlin. I am trying to implement a feature that takes a screenshot when there is an issue in the application and uploads the screenshot to a server. I am currently writing a function that uses DrawingCache and saves the view to a bitmap image. Other than this approach, is there a better way to do this? I was wondering whether there is a way to use the Android OS level screenshot capturing mechanism for this?

  • 1
    check out https://stackoverflow.com/questions/2661536/how-to-programmatically-take-a-screenshot-on-android – Ammar Abdullah May 31 '22 at 06:55
  • `that takes a screenshot when there is an issue in the application` i'm not even sure if this would work, if your app isn't responding, would it even succeed in achieving this ? and what would a screenshot actually help in that case ? – a_local_nobody May 31 '22 at 08:04
  • @a_local_nobody I have implemented the code in a way such in case of any exception, catch it and run the screenshot taking function. For now, it is good for my usecase. should check with your opinion. – Mithun Wijethunga May 31 '22 at 08:21

1 Answers1

0

No. You should only have a screen of your own views, and not other apps nor system status bar. If that is possible, it is a security issue with Android and Google should forbid it.

AIMIN PAN
  • 1,563
  • 1
  • 9
  • 13