0

I am trying to send a log file when my AndroidThings app starts up. I takes about 55 secs to execute the CommandMap.getDefaultCommandMap();

Log.i(LOGTAG,"Mail at 1");
MailcapCommandMap mc = (MailcapCommandMap) ommandMap.getDefaultCommandMap();
Log.i(LOGTAG,"Mail at 2");

The log shows the following:

05-22 12:59:57.414 15649-15649/com.GRAMedical.PillScheduler I/GRAMedicalApp: Mail.<init> Mail at 1  

05-22 13:00:22.436 170-170/? I/update_engine: [0522/130022:INFO:update_manager-inl.h(52)] ChromeOSPolicy::UpdateCheckAllowed: START  

05-22 13:00:22.437 170-170/? I/update_engine: [0522/130022:INFO:chromeos_policy.cc(316)] Periodic check interval not satisfied, blocking until 5/23/2017 0:44:37 GMT  

05-22 13:00:22.437 170-170/? I/update_engine: [0522/130022:INFO:update_manager-inl.h(74)] ChromeOSPolicy::UpdateCheckAllowed: END  

05-22 13:00:29.709 409-579/system_process D/DhcpClient: Received packet: 2c:54:cf:e4:7c:c6 OFFER, ip /192.168.1.120, mask /255.255.255.0, DNS servers: /192.168.1.254 , gateways [/192.168.1.254] lease time 86400, domain null  

05-22 13:00:51.757 15649-15649/com.GRAMedical.PillScheduler I/GRAMedicalApp: Mail.<init> Mail at 2

Does anyone have any idea why this should take 55 secs to execute and if there is a different solution to sending multiple files. The rest of the code to prepare the email and send it seems pretty quick.

Milt
  • 41
  • 2
  • Normally you should not need to CommandMap.getDefaultCommandMap explicitly, although it will be done implicitly when needed. How long does it take to construct a new MailcapCommandMap object? Constructing a MailcapCommandMap object requires finding the config file, which requires looking in several places. Any of these could be slow. Try setting the System property `javax.activation.debug` to `true` to get more debugging output that might help narrow down the cause of the slowness. And make sure you're using the official [JavaMail for Android](https://javaee.github.io/javamail/Android). – Bill Shannon May 22 '17 at 20:55
  • Thanks. I removed the call to getDefaultCommandMap and the corresponding code and everything to work correctly and sends the file in the email. Takes very little time. – Milt May 22 '17 at 21:20

0 Answers0