Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intent result, how to know who sent it?

Is it possible to know which package or process sent the Intent result?

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);

I found a way to know which apps are capable of handling this intent, but I also want to know which one was selected, or rather, which one returned the result. Is this possible?

like image 606
gilm Avatar asked Nov 13 '22 12:11

gilm


1 Answers

It depends on apps how they are developed. Some apps returns an Intent object full of stuff, other empty or null.

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent i) {
         if (i!=null){        
            i.getPackage();
            i.getExtras();
            i.getData();
            i.getScheme();
            i.getType();
           }
        }

Try to log/read all possible values inside Intent.

like image 53
StarsSky Avatar answered Nov 15 '22 13:11

StarsSky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!