Android Question [SOLVED] Difficulty with new receivers to communicate with intents

Star-Dust

Expert
Licensed User
Longtime User
I'm trying to implement the new receivers but with little success.
I enclose several examples below and illustrate the problems encountered


1) I've implemented a receiver that does something when boot completes. It works with Android 7 (after about 2/3 minutes from full boot) it doesn't work with Android 12. Am I doing something wrong?

I attach the example
 

Attachments

  • BOOTstart.zip
    9.7 KB · Views: 193

Star-Dust

Expert
Licensed User
Longtime User
EXAMPLE 2

I tried to intercept SMS messages as per Erel example with receiver modifications... it doesn't work. Am I doing something wrong?
 

Attachments

  • SMSreceived.zip
    9.9 KB · Views: 185
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
EXAMPLE 3

Last chance. To have two of my Apps communicate with the receivers. I used to use the intents to start the activities or services, now I use them for the receivers, but it doesn't seem to get results.

I enclose the code of the Provider (the receiver) and of the Applicant
 

Attachments

  • Provider.zip
    9.6 KB · Views: 179
  • Requester.zip
    9.2 KB · Views: 189
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
I've tested your boot app on an Android 13 device. Works. It can take a 2-3 minutes for the OS to send the intent.

It is possible that your Android 12 device doesn't allow "random" apps to start at boot.
Ok, I understand, I'll look into it further.

The last example, the one that interests us the most, doesn't even work on android 7
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
1. Add the explicit component when sending the intent:
B4X:
in.SetComponent("b4a.myname.prov/b4a.myname.prov.myreceived")
2. Remove the call to SetPackage as it is wrong. It should be the target app package.
3. Remove the category from the intent filter.
Perfect it works. I'll update the examples, maybe they can help others.

Thanks Erel
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
#2 works on android 13. sms is runtime permission. you need to get permission from use. that's all i added to your app
 
Upvote 0
Top