distriqt / airnativeextensions

DEPRECATED: Original repository of the distriqt native extensions and is no longer maintained. Please see our site for the latest ANEs
https://airnativeextensions.com
2 stars 0 forks source link

Cannot send emails using ANE on Android #302

Closed shamruk closed 9 years ago

shamruk commented 9 years ago

Testing on a tablet with Android 4.1.1. Should I add anything special into manifest for this ANE? Message.isMailSupported == true , but no email or any MessageEvent after calling sendMailWithOptions

shamruk commented 9 years ago

May be I can see the logs somewhere

marchbold commented 9 years ago

Hi,

You should be able to see the logs by running

adb logcat

in a terminal. There are some android additions as in the example application:

<android>
    <manifestAdditions><![CDATA[
        <manifest android:installLocation="auto"> 
            <uses-permission android:name="android.permission.INTERNET"/> 
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
            <application>
                <activity 
                    android:name="com.distriqt.extension.message.activities.SendMailActivity" 
                    android:theme="@android:style/Theme.Translucent.NoTitleBar">
                </activity> 
            </application> 
        </manifest>
    ]]></manifestAdditions>
</android>
shamruk commented 9 years ago

I have missed SendMailActivity, thanks.

shamruk commented 9 years ago
var messageAttachment : MessageAttachment = new MessageAttachment(attachment.nativePath, null, attachment.name);
Message.service.sendMailWithOptions(subject, body, recipient, null, null, [messageAttachment]);

After calling this lines I get:

I/com.distriqt.Message::MessageIsMailSupportedFunction( 9363): call
D/com.distriqt.Message::MessageSendMailWithOptionsFunction( 9363): call
D/com.distriqt.Message::MessageSendMailWithOptionsFunction( 9363): HTML Email
W/System.err( 9363): java.lang.NullPointerException
W/System.err( 9363):    at com.distriqt.extension.message.functions.MessageSendMailWithOptionsFunction.call(MessageSendMailWithOptionsFunction.java:84)
W/System.err( 9363):    at com.adobe.air.customHandler.callTimeoutFunction(Native Method)
W/System.err( 9363):    at com.adobe.air.customHandler.callTimeoutFunction(Native Method)
W/System.err( 9363):    at com.adobe.air.customHandler.handleMessage(customHandler.java:22)
W/System.err( 9363):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 9363):    at android.os.Looper.loop(Looper.java:137)
W/System.err( 9363):    at android.app.ActivityThread.main(ActivityThread.java:4745)
W/System.err( 9363):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 9363):    at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 9363):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:810)
W/System.err( 9363):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:577)
W/System.err( 9363):    at dalvik.system.NativeStart.main(Native Method)
shamruk commented 9 years ago

Found the problem. I have should call:

Message.service.sendMailWithOptions(subject, body, recipient, "", "", [messageAttachment]);