2

I have a method channel on flutter from which I call a native java method startCamera. The method startCamera spawns another activity to open camera with startActivityForResult. Now my problem is when the new activity is spanned with startActivityForResult the result is returned in onActivityResult callback and I want this to get returned where the camera activity is called since after starting new activity the method channel method will get destroyed and I will not be able to send the image url back to flutter. I just want to know is there a way to achieve this in Android. 1 way that I am thinkin of is to have an infinite loop on the method channel call handler that will check the value of a variable until it gets set inside onActivityResult asyncronously and return the url when the I gets the value

Shashank
  • 895
  • 1
  • 10
  • 20
  • did you solve this? same exact issue here, I just dont know how to pick it up on flutter side. One solution would be to store it in a varable and call from flutter side like you say but it seems wrong – 68060 Feb 15 '21 at 14:31
  • Yes I solved it by registering an event channel on android side that checks result every second for the default value of a variable by a thread and when the default value is changed I stops the event channel. Default value of the variable is changed from onActivityResult – Shashank Feb 16 '21 at 11:29

0 Answers0