Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App halts on background on Lollipop #2

Open
sulkaharo opened this issue Feb 10, 2015 · 62 comments
Open

App halts on background on Lollipop #2

sulkaharo opened this issue Feb 10, 2015 · 62 comments

Comments

@sulkaharo
Copy link
Contributor

Report from user: when running on Nexus 7 (2012, Android Lollipop 5.0.2), the Uploader stops if the app is put to background. Something changed in Lollipop regarding background app processing?

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

Hi! Sulka, could you talk with that user and retrieve a "debug" MedtronicFile.log???..Please? You know how to do it.

@sulkaharo
Copy link
Contributor Author

I can try. I just installed the platform tools on a new computer and Google has changed the process to something freakishly complicated...

@thaahtel
Copy link

Hi, I try to find and send it to you (here) when I get home (Tero, Marjo's husband).

I just don't know (yet) how to do it. Sulka: do you have any address where I could send you e-mail? If you have one, and are willing to share it with me, you can send me e-mail (it's easy to guess and find my university e-mail address).

@sulkaharo
Copy link
Contributor Author

sulka at sulka.net would be the address :)

@thaahtel
Copy link

Hi,

I just made a new attempt to further investigate what is going on with my Nexus 2012, Lollipop 5.0.2 WLAN and Medtronic uploader.

I used my device as usual between 10.04 p.m. – 10.29 p.m. so that the screen was on. Everything was functioning as it should. After that I pushed the Clear log, and waited a couple of minutes until the screen switched off. After that, there was no new data coming into our Azure Nightscout website.

At 11.00 p.m. I turned the screen on, and Medtronic uploader was running there, but showed no log data on the screen. However, after just two minutes, and just after the arrival of the latest signal from my CGM to CC1111 and Nexus, all the measured CGM data between 10.30 – 11.02 p.m. was uploaded and available in the web.

Therefore, the Medtronic uploader was probably all the time running perfectly with the exception of not sending the data forward when screen was not on.

Also, I have checked that Medtronic uploader sends data to the cloud even if another application is running on the screen (and Medtronic is not shown on the screen, but is running in the background).

And YES, I have selected in my device (Advanced Wi-Fi) “Keep Wi-Fi on during sleep.”

-Tero

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

Definetively...I want the MedtronicFile.log. The behavior that you have described is caused when the uploader can't access the mongodb properly or it detects that you have not internet access...Could be that the function which is checking if you are online or not is failing in Lollipop or for some reason that I can't guess right now.... Mongodb becomes unreachable when your phone sleeps...

@thaahtel
Copy link

How can I send the log file to you?

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

easy, send it to me

@thaahtel
Copy link

I sent the log file to you arbox() and Sulka.

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

thanks!! I'll check it ASAP!!

@thaahtel
Copy link

I forgot to mention: I also checked the Mongolab database: the data does not get there either when the screen is switched off (just as you expected, arbox). When I turn the screen on, CGM data (“the lost values”) get there when it is uploaded there next time (I guess the uploading interval of the device is around five minutes).

The Nexus device, however, is still running otherwise properly when screen is off, and it can for example receive e-mails. Therefore, the WLAN is actually still working and running normally even if the Medtronic uploader does not use it when screen is not on.

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

I have read the log, and I have noticed that I have received NOTHING I restore the data at 23:00 because the sensor stream carries the last 9 values and I detect that I have lost some values so I retrieve them from the sensor stream. But from 10:29 to 23:00 It's like the CC1111 was disconnected... I don't Know right now what could be happening...

@thaahtel
Copy link

But the uploader was running and collecting correct the data through CC1111, right? It just did not send it,

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

Could you try another thing???, could you open the nightscout, wait until receive some values, then press "back" button on your android...that should close the app, but It should start a service also...and you should keep receiving data (tell me If that happens...or not... if not, please send me the log again ;-)). Along this process, please, Do not allow the phone to go to sleep...

@thaahtel
Copy link

Ok, I first close NIghtscout (even restart the Nexus device), then I open NIghtscout and wait until I receive some data values (like 10 minutes, and then I press "back" button. At the same (before pressing the "back" button, I check that the data also gets into the Mongolab. Then I zip the log file and send it to you, ok?

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

That's exactly what I have asked for...;-)

@thaahtel
Copy link

After about five minutes after starting the Nightscout, I had received 3 sensor data values, and the it was updated into the Mongolab. I pressed the “back” button. Now let’s see in three minutes whether the Mongolab database still receives data…

@thaahtel
Copy link

Yes, after five minutes Mongolab correctly received data, so the service was running properly even if the Nightscout was not running in the visibly in the foreground (but IS running in the background).

What should I do now?

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

let it go to sleep
and after five minutes check that you don't receive anything and send the log to me again please

@thaahtel
Copy link

OK!

@thaahtel
Copy link

The device is not sending anything to Mongolab. However, if I open the screen, Nightscout MAY send the data quite quickly into Mongolab DB, so I'll close the application/service immediately after turning the screen on, right?

@thaahtel
Copy link

what
on
earth?

Mongolab just received some data? (timestamp 01:29, but it was not there just three minutes ago (01.30).

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

have you opened the screen??
or it is still off?

@thaahtel
Copy link

No, the screen ahs been, and still is, closed.

Could it be that the mail I sent was syncronized to my gmail in the device, and that somehow triggered the OS and the update action?

@thaahtel
Copy link

After that (1:29) Mongolab has not received anything,

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

Could be...I don't know...perhaps if someone send you a whatsapp, or triggers any event on the phone, It could trigger the uploads again... I am not really sure...

@thaahtel
Copy link

Ok, no news in Mongolab. What shall I do next? Open the screen and turn off the Nightscout, and then send you the log file?

I tried to send me an e-mail to my gmail address, but this time nothing happened (or after that). There should not be any other program running in the background.

@arbox0
Copy link
Owner

arbox0 commented Feb 11, 2015

You don't have to turn off the Nightscout, just send me the log

@thaahtel
Copy link

I sent the log to your e-mail. And of course, soon after turning the screen on, Mongolab was updated because the Nightscout was and still is running in the background

@arbox0
Copy link
Owner

arbox0 commented Feb 12, 2015

I have sent you an answer.... ;-)

@thaahtel
Copy link

Has someone also fixed something related to the selection of mmol/L nad mg/mL ? And possibly also some other changes?

@thaahtel
Copy link

Sorry, the new version did not help either. It has the same problem as the earlier version and it also behaves otherwise similarly. I’ll send you both the new log file related to this software version.

@arbox0
Copy link
Owner

arbox0 commented Feb 12, 2015

Please, could you check if you have active the "Battery Saver" and in case you do...Could you turn it off and try again???

I have read this: "To help improve battery life, battery saver reduces your device's performance and limits vibration and most background data. Email, messaging and other apps that rely on syncing may not update unless you open them."

Which seems exactly what is happening to you....

If you have any other app like battery saver, or battery shield or some like that...could you deactivate it???

@sulkaharo
Copy link
Contributor Author

I have the battery saver turned on with Android 4.4 and the Uploader works fine. Having said that, Google really emphasised Lollipop as a battery saving update, so it's possible they've changed how OTG devices work. Luis have you checked the multitasking changes in Lollipop? There's a new API for tasks that run when the app is not active.

@thaahtel
Copy link

Sorry, battery saver mode was off all the time during the tests.

When I got into trouble I tried to minimize all such things that could cause troubles (I did not have anti-virus software, firewall or any other additional software/services on). I wiped the cache and also restarted the Nexus device between different tests yesterday so that I could eliminate any possible outside effects.

@thaahtel
Copy link

I do not have any other Lollipop compatible devices, so I can't test and tell whether this symptom is related to the whole Lollipop 5.0.2 OS (and thus all the devices using it) or if this is just happening with Nexus 7 (2012).

@MosiGitHub
Copy link

Hi. I think this problem is still not solved, right? I am presently trying to make NightScout running on a HTC ONE (M7) with Lollipop 5.0.2. But after a while there are no more values received by the medtronic uploader. Could be the same problem. I also use a SONY Xperia Z3 with Lollipop 5.0.2 and will shortly start a test with this one. So, if you are still interested in LOG-files, just let me know.
Because I wanted to avoid to downgrade these phones to 4.4. or elder, I tried to make an old HTC Desire HD working with NightScout and installed a custom rom on that should support OTG. But so far with no success.

@sulkaharo
Copy link
Contributor Author

@MosiGitHub note there's more than one issue related to the uploads stopping spontaneously, which affect all versions of Android. Can you describe the issue you're having in more detail? As in, does the upload stop very quickly and consistently or a few hours after starting the app?

@stavlor
Copy link

stavlor commented Jun 1, 2015

From what I've heard the USB OTG power changes in lollipop have been causing issues for most using OTG in lollipop

@MosiGitHub
Copy link

Hi stavlor, thank you. I just ordered an y-cabel. Maybe this stabilizes the power the mmcommander receives. Should be there tomorrow. Thanks Amazon 😉

@MosiGitHub
Copy link

@sulkaharo: thanks for your assistance. the transfer stops approx. after 30 minutes. It seems to be sufficient to disconnect the cabel from the phone and reconnect after a couple of seconds. They it work again for ~ 30 minutes. I reprogrammed the mmcommander, but no change. Which release of the uploader would you recommend?

@MosiGitHub
Copy link

@stavlor: it is now working for two hours - New record for me. Because of your advice I installed "OTG Power Lock". Maybe it was really a problem with the OTG power supply.

@MosiGitHub
Copy link

So, lost connection again...

@MosiGitHub
Copy link

@sulkaharo: I didn't find anything about the issues that could cause the problems in the net. Is there any site you could recommend to me? Please advise, because I still have the problems and it would be great to get nightscout running. Best regards.

@melsmith
Copy link

Are you on the latest version of MMCommander as released a couple of weeks ago? It improves calibration of the RF module on the C1111 which for us has stopped it not receiving/uploading after some 8hrs +

@sulkaharo
Copy link
Contributor Author

Also note the uploader was updated just today - please update and report if it helps. :)

On 15 Jul 2015, at 01:57, melsmith [email protected] wrote:

Are you on the latest version of MMCommander as released a couple of weeks ago? It improves calibration of the RF module on the C1111 which for us has stopped it not receiving/uploading after some 8hrs +


Reply to this email directly or view it on GitHub.

@MosiGitHub
Copy link

@melsmith: thanks for the hint with the mmcommander 👍
@sulkaharo: thank you for the new uploader. After updating both, the mmcommander and the uploader nightscout was running the whole night for the first time 👏😀
Seems to be working now, but definitly I can jugde this in the next couple of days.
Thank you all so much for helping us. 👍

@MosiGitHub
Copy link

So, after some more days of testing it seems to me that it works better but still not stable 😔

@yiyoMX
Copy link

yiyoMX commented Nov 11, 2015

I agree, I have a Moto G 1rst Gen with android 4.4.4, and it runs all night, the issues that I have are:
It crashes when there is no internet connection for a while.
If Im in the home page of the app, and press the back button it pops up a message saying "connected", when I click again on the nightscout icon to open the app the app reopens with the title "CGM Service stopped", in red, and then it chages to green and says "CGM Service Started", I think it supposedly keep uploading data after the back button is pressed.
I renabled the manual calibration, sometimes I used instant calibration, because I change the cc1111 to another phone while charging, and if I enter i.e. 130, the next value of the sensor recieved is 300, so its way way off with instant cal for me, sometimes it works fine.

@arbox0
Copy link
Owner

arbox0 commented Nov 11, 2015

When you press "back button", you kill the main app and a background service is started, which continues using the cc1111 to receive data and upload it to Mongo DB, when you tap on the nightscout icon again the background service is stopped and the main app is "restarted" but the data info is shared between them, that's why "CGM Service stopped" appears in red on your screen, because you are starting the app again.

I have kept my LG G3 on airplane mode 5 minutes and the app has not crashed, how much time do you wait until it crashes?.

Instant calibration should work well...but If you are changing the cc1111 from one phone to another, perhaps the method for calibration that you are following is not the "ideal"...you should wait until a new value is received from the sensor....(with your oldest calibration), and after that you do instant calibration...that should do the trick!!...

@yiyoMX
Copy link

yiyoMX commented Nov 11, 2015

Ok, thats good to know! I have it working with azure rest api.
Its like 30 mins after started or so.
I´ll try that method, so, what was the difference for manual and instant calibration?, If it has the same accuracy I prefer instant because sometimes the manual never ends (The message of calibrate wait 15 more minutes never chages).

@arbox0
Copy link
Owner

arbox0 commented Nov 11, 2015

Which version of the uploader are you using? Manual calibration should not be available in the lastest version...Instant calibration is the only choice and is the best option

@arbox0
Copy link
Owner

arbox0 commented Nov 11, 2015

You should have this version installed https://github.com/arbox0/MedtronicUploader/releases/tag/MEDTRONICUPLOADER_R1_V7

Please, before install it uninstall the previous version

@yiyoMX
Copy link

yiyoMX commented Nov 11, 2015

I modified the source code of the latest version to enable the manual calibration and recompiled, so its the latest one. I´ve now changed to the unmodified one R1 V7, and in about 10 mins, the app freezes, its unresponsive to touch, or messages on screen. Its android 4.4.4 Moto G v1.
Have you heard about https://github.com/ps2/rileylink ?, its a BLE bridge for medtronic devices, do you think its difficult to modify your app so its compatible?, the advantage is that the user would not have to have a cable connected all the time to the smartphone or have a separate phone to carry and pay data.
Are you from Spain?

@arbox0
Copy link
Owner

arbox0 commented Nov 12, 2015

Yes! I am from Spain.

OMG! 10 minutes before freezing???....that's too weird....could you change the use from API rest to Mongo API REST???. I would like to see your preferences also, and If it is possible, I would like to get the MedtronicUploader.log file which is located in your Internal Memory on the root directory, in my LG is /storage/emulated/0/MedtronicUploader.log

I didn't know about rileylink, I'll talk about this with Jesús Berian, and I'll tell you if I can change my code to support it. I have already other plans to add BLE to the medtronic uploader, but I'll check this option as well.

@yiyoMX
Copy link

yiyoMX commented Nov 12, 2015

I'm from Mexico, so we can talk in Spanish or in English if you prefer.
Also, I've being trying the instant calibration and its way of the
glucometer value, the last 3 times for about 20 points, I find that using
manual calibration is way more accurate, could this be? I think its because
the manual calibration averages the 3 first values dont it? With instant
calibration I enter the glucometer value, not the pump value as the message
says, I think if I enter the pump value, it would be more accurate because
It would be a calibrated value by the pump.

The settings are: mmol/l diabled, Type: Medtronic CGM, Pump ID: nothing,
Glucometer ID: nothing, Sensor ID: my sensor ID, Calibration Type, Manual,
Glucose Value Source: Medtronic Sensor, API Upload(REST) enabled, API Base
URL: my API Base URL, Data Base Name (I dont know If I have to put the
database name because its usign API Upload, but its enabled so I did), Wifi
Hack disabled, 2 Days at Startup (Ive tried this enabled and disabled).

I know where the log is, what level would you want, error, info or debug?

Also, I dont know If I could have your mail so we dont have to write here
everything.

El nov. 12, 2015 2:22 AM, "arbox0" [email protected] escribió:

Yes! I am from Spain.

OMG! 10 minutes before freezing???....that's too weird....could you change
the use from API rest to Mongo API REST???. I would like to see your
preferences also, and If it is possible, I would like to get the
MedtronicUploader.log file which is located in your Internal Memory on the
root directory, in my LG is /storage/emulated/0/MedtronicUploader.log

I didn't know about rileylink, I'll talk about this with Jesús Berian, and
I'll tell you if I can change my code to support it. I have already other
plans to add BLE to the medtronic uploader, but I'll check this option as
well.


Reply to this email directly or view it on GitHub
#2 (comment)
.

@arbox0
Copy link
Owner

arbox0 commented Nov 13, 2015

Debug level would be perfect.... you can send it to [email protected]. In that mail you can use Spanish if you want to, but here and thinking on other people that might be reading us, it is better that we keep using English for communication.

The pump makes its own calculations on the data received from the sensor, we can't replicate those calculations, but your glucometer is more accurate than the pump, so I would think that the difference between your pump and your nigthscout values, could be more accurate in the lastest...(or not).... If you set the pump value, it should work as you expect.

Thanks for the info!!

@MosiGitHub
Copy link

Hi. Just an update to the problems I reported 5 month ago. I changed the uploader phone and I am now using a Sony Xperia Z3 instead of the HTC One (M7). Everything is working now. The problems seem to be caused by the phone. Best regards and thanks for your work.

@Gryph66
Copy link

Gryph66 commented Feb 1, 2017

Just reading this and having similar issues on my nvidia shield K1 tablet (w lastest android). Using all the latest releases but guessing the OTG must turn off when the tablet sleeps.

When tablet is awake, with app open or closed, works flawlessly. As soon as tablet is turned off, cover closed it halts.

Problem solving it now, but going to try my setup on an older Samsung Note 2 and see. Thanks for all the back and forth on this. Does anyone know for sure if this is a common problem on newer devices?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants