简体   繁体   English

Android-如何将捆绑软件从一个应用发送到另一个?

[英]Android - How to Send Bundle from One App to Another?

I am working on a cryptography Android application for a course project. 我正在为课程项目开发密码学Android应用程序。 My goal is to be able to send an encrypted message (composed of a key and ciphertext) from my application via a text message. 我的目标是能够通过文本消息从我的应用程序发送加密的消息(由密钥和密文组成)。

I have been trying to send the key and ciphertext as a Bundle, but am running into issues - when I actually attempt to send the Bundle, it is not appearing in the default text messaging app. 我一直试图将密钥和密文作为捆绑包发送,但是遇到了问题-当我实际尝试发送捆绑包时,它没有出现在默认的短信应用程序中。 My code is below and any help/pointing me in the right direction would be greatly appreciated! 我的代码在下面,对我的正确指导将不胜感激!

Thanks! 谢谢!

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);

My goal is to be able to send an encrypted message (composed of a key and ciphertext) from my application via a text message. 我的目标是能够通过文本消息从我的应用程序发送加密的消息(由密钥和密文组成)。

That would be pointless, as then anyone can decrypt the message. 那将毫无意义,因为任何人都可以解密该消息。

when I actually attempt to send the Bundle, it is not appearing in the default text messaging app 当我实际尝试发送捆绑软件时,它没有出现在默认的短信应用程序中

ACTION_SEND does not support arbitrary extras, such as Key or Ciphertext . ACTION_SEND不支持任意附加功能,例如KeyCiphertext

The sharing Intent using ACTION_SEND follows a specific format in order for the receiving so app to understand the data. 使用ACTION_SEND的共享Intent遵循特定的格式,以便接收的应用程序能够理解数据。 In this case, you would need to provide the message text (your combination of key and cipher text) as an extra using the key Intent.EXTRA_TEXT . 在这种情况下,您将需要使用密钥Intent.EXTRA_TEXT额外提供消息文本(密钥和密文的组合)。 See this page for more details: https://developer.android.com/training/sharing/send.html 请参阅此页面以获取更多详细信息: https : //developer.android.com/training/sharing/send.html

Also, unless that key you are sending is a public key, this is bad practice. 另外,除非您要发送的密钥是公共密钥,否则这是一种不好的做法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 Bundle Array 值发送​​到 android 中的另一个活动? - How can i send Bundle Array value to another activity in android? Android_如何将捆绑发送给另一个活动? - Android_ How can I send a Bundle to another activity? 如何在Kitkat Android中将图像从一个活动发送到另一个活动? - How to send image from one activity to another in kitkat android? 如何在Android中将图像从一个活动发送到另一个活动 - How to send image from one activity to another in android 如何在android中将Calendar对象从一个活动发送到另一个活动? - How to send a Calendar object from one activity to another in android? 如何在Android中将一个活动的对象列表发送到另一个活动? - How to send a list of objects from one activity to another in android? 如何在Android中将TCP套接字从一个活动发送到另一个活动? - How to send TCP Sockets from one Activity to another in android? 如何在Android中将数据从一个活动发送到另一个活动? - how to send data from one activity to another in android? 如何在Android中将哈希映射数组从一个活动发送到另一个活动 - How to send array of Hashmap from one activity to another activity in android Android:如何将接口从一个活动发送到另一个活动 - Android: How to send interface from one activity to another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM