Android Question No working example to Broadcast a private Message between Apps?

Jehoschua

Member
Licensed User
Good evening

I've just started to use B4A and it's really great to get the 1st result and debugging with hot code replacement is really great!
Unfortunately, as soon as one tries to use more advanced subjects like using Android Broadcast or sending SMS with more than 160 characters, it gets hard, because it does not "just work".
It's great that another user has solved the 160 character SMS problem, (but it's strange that the solution is not part of the core library and that Users have to google for it and evaluate different "solutions" (most proposals are not working).)


but does someone knows a working example to send a private Message between two applications?

The use case is very simple:
  1. The Main App receives a Ping broadcast ("com.mydomain.MyApp.Ping") and notifies the reception by e.g. ToastMessageShow. (Later, the Main App sends back an answer)
  2. The Watchdog App sends a Ping broadcast ("com.mydomain.MyApp.Ping") explicitly to the Main App (maybe by using SetPackage("com.mydomain.MyApp")).
I would be very grateful if someone has a similar example.



Just for interested readers: here are the issues I've found with the existing Libraries:
After more than 4 hours, I was not able to get any Android Broadcast working using B4A:
  • The builtin Intent command / library
    • is not able to send a broadcast.
      • Maybe it is intelligent and automatically sends the right message, but then, it does not know the private message ("com.mydomain.MyApp.Ping")
    • does to offer SetPackage,
      but I must send the Message to exactly one App.
      Maybe Intent renamed the SetPackage method to SetComponent, but I hope it does not. (It's usually a bad idea if a wrapper renames things: users can no longer use Doc and Examples from the original Library).
  • The BroadCastReceiver...
    • does neither offer a Documentation nor useful examples :-(
    • does not allow to send additional data :-(
    • the BroadcastReceiver Forum contains 6 pages with many reported problems, java exceptions, and questions, but there are almost no working solutions :-(
    • » it would be very helpful if every B4A library must have a "Library-State information", e.g.
      Green: stable
      Orange: "be careful if you use it"
      Red: Dead / known bugs

Thanks a lot for any help!
kind regards,
Thomas
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Jehoschua

Member
Licensed User
Thank you very much, DonManfred, for this helpful link!
I try to understand how this magic works :).

It really works and it would be useful for next "users searching for help" to add this Tutorial Link to the Library BroadCastReceiver Forum. It's really very annoying if one downloads a Library which brings many questions and more problems than it solves...
 
Upvote 0
Top