![](/img/trans.png)
[英]How can i send Bundle Array value to another activity in android?
[英]Android - How to Send Bundle from One App to Another?
我正在为课程项目开发密码学Android应用程序。 我的目标是能够通过文本消息从我的应用程序发送加密的消息(由密钥和密文组成)。
我一直试图将密钥和密文作为捆绑包发送,但是遇到了问题-当我实际尝试发送捆绑包时,它没有出现在默认的短信应用程序中。 我的代码在下面,对我的正确指导将不胜感激!
谢谢!
Intent sendIntent = new Intent();
Bundle extras = new Bundle();
extras.putString("Key", key.getText().toString());
extras.putString("Ciphertext", cipherText.getText().toString());
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtras(extras);
sendIntent.setType("text/plain");
startActivity(sendIntent);
我的目标是能够通过文本消息从我的应用程序发送加密的消息(由密钥和密文组成)。
那将毫无意义,因为任何人都可以解密该消息。
当我实际尝试发送捆绑软件时,它没有出现在默认的短信应用程序中
ACTION_SEND
不支持任意附加功能,例如Key
或Ciphertext
。
使用ACTION_SEND
的共享Intent
遵循特定的格式,以便接收的应用程序能够理解数据。 在这种情况下,您将需要使用密钥Intent.EXTRA_TEXT
额外提供消息文本(密钥和密文的组合)。 请参阅此页面以获取更多详细信息: https : //developer.android.com/training/sharing/send.html
另外,除非您要发送的密钥是公共密钥,否则这是一种不好的做法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.