简体   繁体   中英

Send a POST request via intent

I need to send a POST request to another application, via intent. I tried the following code but it only makes a GET request. I don't know how I can pass the POST parameters.

Intent intent = new Intent(Intent.ACTION_VIEW, url);
intent.setPackage("app.package.name");    
PackageManager packageManager = requireActivity().getPackageManager();
if (intent.resolveActivity(packageManager) == null) {
  //do something
}
intent = new Intent(Intent.ACTION_VIEW, url);
startActivity(intent);

I need to send a POST request to another application, via intent

If you wrote the other application, you can create your own protocol for passing the rest of the details, such as via Intent extras.

If you did not write the other application, then most likely you have no ability to force it to do a POST request. You would have to read the documentation for that other application — if any documentation exists — to see what sort of Intent -based API it exposes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM