In order to send an e-mail without user intervention from my devices (Nexus7 & Samsung galaxy S5) I followed the procedures described in Send Email in Service (without prompting user)
and http://www.jondev.net/articles/Sending_Emails_without_User_intervention_(no_Intents)_in_Android
Both sent the e-mail correctly, but I always end up with a popup message "Gmail has stopped" on my device, which is not very thrustworthy for the users of my App and by which makes both solutions unusable.
Is there another solution, or how can I get rid of this error?
Logcat shows the following errors:
03-17 11:44:32.324: I/Gmail(2797): Sending provider changed intent: Intent { act=android.intent.action.PROVIDER_CHANGED dat=content://gmail-ls/unread/^i (has extras) }
03-17 11:44:32.341: I/Gmail(2797): Sending provider changed intent: Intent { act=android.intent.action.PROVIDER_CHANGED dat=content://gmail-ls/unread/^iim (has extras) }
03-17 11:44:32.365: I/Gmail(2797): notifyAccountChanged
03-17 11:44:32.368: I/Gmail(2797): getAccountsCursor
03-17 11:44:32.369: W/Gmail(2797): Sync complete for account: account:-654877552
03-17 11:44:32.379: W/GAV2(2797): Thread[SyncAdapterThread-1,5,main]: dispatch call queued. Need to call GAServiceManager.getInstance().initialize().
3-17 11:44:32.380: E/AndroidRuntime(2797): FATAL EXCEPTION: SyncAdapterThread-1
03-17 11:44:32.380: E/AndroidRuntime(2797): Process: com.google.android.gm, PID: 2797
03-17 11:44:32.380: E/AndroidRuntime(2797): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getScheme()' on a null object reference
03-17 11:44:32.380: E/AndroidRuntime(2797): at android.content.ContentResolver.openInputStream(ContentResolver.java:630)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.aV.b(SourceFile:6237)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.bh.HC(SourceFile:4213)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.bh.<init>(SourceFile:4186)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.bo.a(SourceFile:3898)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.Operations.b(SourceFile:628)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.aV.a(SourceFile:5936)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.MailSync.a(SourceFile:899)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.MailEngine.a(SourceFile:2432)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.MailEngine.a(SourceFile:2129)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.bp.a(SourceFile:127)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.common.b.onPerformSync(SourceFile:33)
03-17 11:44:32.380: E/AndroidRuntime(2797): at com.google.android.gm.provider.bp.onPerformSync(SourceFile:82)
03-17 11:44:32.380: E/AndroidRuntime(2797): at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
03-17 11:44:32.417: I/NotifUtils(2797): Validating Notification, mapSize: 1 getAttention: true ignoreUnobtrusive: false