I am new to mobile programming and may need some explanation on basic mobile concepts.
My question is, if I want an Android app A to send a string data to another app B, is that possible to send it when B is closed on the device?
So when user opens B later, B can still receive the message from A, regardless of A is closed or not.
I have read many questions on sendBroadcast with intent, and other mechanism. But I cannot tell it that works for my question.
Thanks!
===================== Update based on comments ======================
I don't own app B. I only own app A. I have agreement with B's owner that a string generated by A needs to be sent to B.
The only goal is that B should receive this string from A. We don't have follow-up actions after that, and how B deals with the string data is out of scope in this question.
Basically as owner of A, for a specific android device, I don't know if:
I just have an agreement with B's owner that we will send it from A when A is opened, and B will receive it when B is opened later. Note that we also agree that A should not check if B is installed on the phone.
I will clarify a little bit on the purpose but won't go too deep. This is part of a research. A and B are independent parts of research where B is used to validate A. It's required that A does not know B exists on the device. So an ideal mechanism is that A just sends the string out without a targeted receiver (broadcast maybe?). If B exists on the device, it can get it. If not, the string just goes nowhere.
We can assume B will be used by research participants in some frequency that can be managed. Like every month, every week, every day, etc. An additional requirement needs to be considered is if the string sharing mechanism can succeed when there's good amount of time (a day, a week, a month) between user using A and B. If we need different mechanism for different latencies, please let me know.
most accurate and reliable way to do this is AIDL - interface created for communication between two different apps/processes, so yes, its possible :)
a little less secure, way less scalable, but also very quick in impl are broadcasts with intents, and there is also a way for some communication with server-side, which can keep message for offline user, re-send when log in. ugly workaround would be to communicate through/using "shared file" left in some public place (download folder?), which can be read by both apps.
Plenty of ways for doing such feature, but crucial question is: do you "own" both apps/sides of communication? Depending on answer some possibilities may not fit...