Search code examples
androidemailjakarta-mailgoogle-glassgoogle-gdk

Sending Email in Google Glass


I'm trying to send a email to a (at this moment) hardcoded email adress when a streaming link is generated. I tried using the piece of code that was accepted as awnser HERE

However I'm getting a error saying:

No provider for smtp

does anyone have a clue on what could be causing this? I dragged the needed .jar files into my libs folder. In my gradle.build file I added them to be compiled

compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')

In my settings.gradle file I added

include ':libs:activation.jar'
include ':libs:additionnal.jar'
include ':libs:mail.jar'

My manifest looks like this when it comes to permissions

<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

has anyone experienced this problem before? Is there a fix for this or a different way for me to send a email from my code.

Hope someone is able to help me with this.


Solution

  • I found a solution for my problem. I was using the jar files that where linked in the awnser. However it seems that mail.jar file is outdated or just not working properly.

    I downloaded the following mail.jar

    JavaMail API 1.4.7

    Then I replaced my current mail.jar file with the one found in the zip file. I ran the code again and got a message saying

    Please log in via your web browser and then try again.

    I then went to my google security settings and "Access for less secure apps" was on.

    I ran my code again and voila I got a mail in my inbox.

    I hope other people with the similair problem find use in this.