Android Question Issue with an app/service sending email/sms at midnight

imbault

Well-Known Member
Licensed User
Longtime User
Hi Everyone,


I've developped a small app which has an activity layouts, but also launches a service (which runs if the mobile reboots), the purpose of the service is to send all the days at midnight some informations entered in the app: no pb with that.
So at 00:00, the service will send an eMail via SMTP and a SMS (to an address and a mobile number entered in a parameter screen).

This app and service works on my main mobile (samsung S4) and a collegue mobile (samsung S4) without any pb.

By the way, I deployed this app only sending the APK file by email, no play store.

But for the person who is supposed to really use this app, nothing is send at midnight. So I add a button to to that send duty which works for him. But The service, not at all, I must to add that his mobile is on silent mode at midnight (not airplane mode, lol).

So maybe, someone did face the same pb

Many thanks.

Patrick
 

imbault

Well-Known Member
Licensed User
Longtime User
Thank you @Peter Simpson, I keep my global variables in the service module, I've just sent the new apk to my customer. Hoping it will fire at midnight, this way much better than using a Timer (which should technically works..., another story)

Thank you for your help
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
It didn't work, on an S3? I have a lot of active users (about 1800) using one of my apps which uses a service and that exact same code. Looking at the developers console a good number of those users are using S3 phones with no issues whatsoever.

Hmm but thinking about it now, I added the following code snippet to one of my apps as I was getting issues especially with Samsung devices, I'm no longer having any issues whatsoever. Please copy the sub routine in the link below into your project, and make it the first sub routine that you call when it's midnight, then call your email sub routine.

I now use this code snippet below in all my apps that has to contact the internet for anything. Leave your current code in place.

https://www.b4x.com/android/forum/threads/workaround-the-networkonmainthread-exception.44760/
 
Last edited:
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
It didn't work, on an S3? I have a lot of active users (about 1800) using one of my apps which uses a service and that exact same code. Looking at the developers console a good number of those users are using S3 phones with no issues whatsoever.

Hmm but thinking about it now, I added the following code snippet to one of my apps as I was getting issues especially with Samsung devices, I'm no longer having any issues whatsoever. Please copy the sub routine in the link below into your project, and make it the first sub routine that you call when it's midnight, then call your email sub routine.

I now use this code snippet below in all my apps that has to contact the internet for anything. Leave your current code in place.

https://www.b4x.com/android/forum/threads/workaround-the-networkonmainthread-exception.44760/

He uses an Acer V360, his wife uses a galaxy S3

I've add this code before sending email, but why it doesn't send a SMS...
makes ma crazy

thank you for the link
 
Upvote 0
Top