I am using the android-send-me-logs api and everything works fine except the sending of the logs via email. The source code here is:
public void sendLog(String email, String subject, String preface) {
ArrayList<String> lines = mLastLogs;
if (lines.size() > 0) {
Uri emailUri = Uri.parse("mailto:" + email);
StringBuilder sb = new StringBuilder(preface)
.append(LINE_SEPARATOR);
String phoneInfo = collectPhoneInfo();
sb.append(LINE_SEPARATOR).append(phoneInfo);
for (String line : lines)
sb.append(LINE_SEPARATOR).append(line);
String content = sb.toString();
Intent intent = new Intent(Intent.ACTION_SENDTO, emailUri);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_TEXT, content);
mContext.startActivity(intent);
}
}
I am calling this method and it's all working great - BUT I never receive the email! I have tried several CORRECT email addresses already (inlcuding googlemail), but of no avail. I can display an AlertDialog instead of sending the email and I s开发者_开发技巧ee all the logs displayed. That's no problem. But for some reason I am not getting the email. Any idea? I am on Android 2.3.3 and Samsung Galaxy S2. Thanks!
If your message is longer than 40K then it's impossible to send it in this manner. Intents are built on top of Binder and they cannot transfer more than 40K of information. Here you can find these details.
Try sending the log as an attachment. You may want to look at my complete solution write-up: Need to handle uncaught exception and send log file
I have a thorough answer on how to put logs into a log file and email them (logcat into a file & logging to a file): Android LogCat File Location and Emailing A Copy of It
精彩评论