Android Question SMS intercept and Google Navigation problem

DTsEMT

Member
Licensed User
Longtime User
Hi all,

I'm trying to develop a simple app which does the following:

1. Allows the user to tap and select a Contact;
2. Allows the user to enter a destination
3. Starts GPS and does a few things on the _LocationChanged event.
4. If a text message is received from that contact, use TTS to read it out loud.

The app then calls Google Navigation and starts SMS intercept. The problem I'm running into is that, while Google Navigation is running, all incoming SMS messages are intercepted correctly, but they're then sent to a queue in the main process. The TTS routine never fires.

From the SMS module I've tried CallSubDelayed2(Main, "Readit", TextMessage), but the main process is never brought to the foreground because the navigation app is running;

I've tried CallSub2(same stuff), but again, the main process is never brought forward because Navigation is running.

Do I need to somehow pause navigation, or is there something like a DoEvents that operates on the message queue?

Thanks!
 

DTsEMT

Member
Licensed User
Longtime User
Thanks for the quick response!

I tried putting the TTS code in the SMS_Intercept service module to avoid restarting the main application. I found that TTS never initialized, even with a timer loop embedded.

The StartActivity tool tips states that "normally" StartActivity should not be called from a service module. I guess this is an exception.

Thank you again!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The StartActivity tool tips states that "normally" StartActivity should not be called from a service module.
Starting an activity from a service (when the app is in the background) is usually considered bad practice because the user will be surprised to see an activity jumping from nowhere while they are busy with a different app.

I tried putting the TTS code in the SMS_Intercept service module to avoid restarting the main application. I found that TTS never initialized, even with a timer loop embedded.
Can you post the relevant code?
 
Upvote 0
Top