Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15884] Android: Can't use the EXTRA_EMAIL property for adding recipients to mail

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-03-05T21:52:43.000+0000
Affected Version/sRelease 3.1.3
Fix Version/s2014 Sprint 05, 2014 Sprint 05 API
ComponentsAndroid
LabelsSupportTeam, module_emaildialog, qe-closed-3.3.0, qe-manualtest, qe-testadded
ReporterNadav Hoze
AssigneeBiju pm
Created2013-11-28T08:22:01.000+0000
Updated2014-10-16T00:12:25.000+0000

Description

Problem Description

When not using the Ti.UI.Emaildialog but creating my own email Intent I cannot set the EXTRA_EMAIL property, which it's purpose is for recipients. This is because this property expects array of strings but titanium does not support this conversion in the putExtra method of IntentProxy. Hello, I have tested this issue with test code. I got same warning message. I think this is a bug.

Testing environment:

OS: MAC OS X 10.8.5 Ti SDK: 3.1.3 GA Ti CLI: 3.3.0 Android SDK 2.3.3

Test Code

var win = Ti.UI.createWindow({
	backgroundColor : '#fff'
});
var button = Ti.UI.createButton({
	title : 'Share'
});
win.add(button);
win.open();

button.addEventListener('click', function() {
	var intent = Ti.Android.createIntent({
		action : Ti.Android.ACTION_SEND,
		type : 'message/rfc822'
	});
	intent.putExtra(Ti.Android.EXTRA_SUBJECT, 'My subject!'); 
	intent.putExtra(Ti.Android.EXTRA_EMAIL, ['email@gmail.com','email@yahoo.com']);
	intent.putExtra(Ti.Android.EXTRA_TEXT, 'My text!');
	try {
		Ti.Android.currentActivity.startActivity(intent);
	} catch (ex) {
		/* Handle Exception if no suitable apps installed */
		Ti.UI.createNotification({
			message : 'No sharing apps installed!'
		}).show();
	}
});

Logs

11-29 23:12:50.445: W/TiIntent(7164): (KrollRuntimeThread) [14183,14183] Warning unimplemented put conversion for java.lang.Object[] trying String
11-29 23:12:50.445: W/TiIntent(7164): (KrollRuntimeThread) [0,14183] Warning unimplemented put conversion for java.lang.Object[] trying String
11-29 23:12:50.445: I/ActivityManager(96): Starting: Intent { act=android.intent.action.SEND typ=message/rfc822 cmp=com.google.android.gm/.ComposeActivityGmail (has extras) } from pid 7164
11-29 23:12:50.485: I/ActivityManager(96): Start proc com.google.android.gm for activity com.google.android.gm/.ComposeActivityGmail: pid=7178 uid=10009 gids={3003, 1015}
11-29 23:12:50.515: D/dalvikvm(67): GC_EXPLICIT freed 11K, 53% free 2540K/5379K, external 1625K/2137K, paused 41ms
11-29 23:12:50.585: D/dalvikvm(67): GC_EXPLICIT freed <1K, 53% free 2540K/5379K, external 1625K/2137K, paused 60ms
11-29 23:12:50.635: I/ActivityThread(7178): Pub gmail-ls: com.google.android.gm.provider.MailProvider
11-29 23:12:50.635: D/dalvikvm(67): GC_EXPLICIT freed <1K, 53% free 2540K/5379K, external 1625K/2137K, paused 46ms
11-29 23:12:50.675: I/ActivityThread(7178): Pub com.google.android.gm.attachmentspreviews: com.google.android.gm.AttachmentPreviewProvider
11-29 23:12:50.685: I/ActivityThread(7178): Pub com.google.android.gmail.SuggestionProvider: com.google.android.gm.SuggestionsProvider
11-29 23:12:50.695: I/ActivityThread(7178): Pub gmail-downloads: com.google.android.gm.downloadprovider.DownloadProvider
11-29 23:12:50.715: I/ActivityThread(7178): Pub com.google.android.gm: com.google.android.gm.provider.PublicContentProvider
11-29 23:12:50.765: I/ActivityManager(96): Starting: Intent { act=android.intent.action.SEND typ=message/rfc822 flg=0x2000000 cmp=com.google.android.gm/.ComposeActivity (has extras) } from pid 7178
11-29 23:12:50.775: I/ActivityManager(96): No longer want com.android.packageinstaller (pid 7061): hidden #16
11-29 23:12:51.165: I/Gmail(7178): calculateUnknownSyncRationalesAndPurgeInBackground: queueing
11-29 23:12:51.195: I/Gmail(7178): calculateUnknownSyncRationalesAndPurgeInBackground: running
11-29 23:12:51.455: W/Bundle(7178): Key android.intent.extra.EMAIL expected String[] but value was a java.lang.String.  The default value <null> was returned.
11-29 23:12:51.475: W/Bundle(7178): Attempt to cast generated internal exception:
11-29 23:12:51.475: W/Bundle(7178): java.lang.ClassCastException: java.lang.String
11-29 23:12:51.475: W/Bundle(7178): 	at android.os.Bundle.getStringArray(Bundle.java:1459)
11-29 23:12:51.475: W/Bundle(7178): 	at android.content.Intent.getStringArrayExtra(Intent.java:3630)
11-29 23:12:51.475: W/Bundle(7178): 	at com.google.android.gm.ComposeArea.initFromExtras(ComposeArea.java:620)
11-29 23:12:51.475: W/Bundle(7178): 	at com.google.android.gm.ComposeActivity.initFromExtras(ComposeActivity.java:1482)
11-29 23:12:51.475: W/Bundle(7178): 	at com.google.android.gm.ComposeActivity.finishOnCreateAfterAccountSelected(ComposeActivity.java:1020)
11-29 23:12:51.475: W/Bundle(7178): 	at com.google.android.gm.ComposeActivity.onCreate(ComposeActivity.java:259)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-29 23:12:51.475: W/Bundle(7178): 	at android.os.Handler.dispatchMessage(Handler.java:99)
11-29 23:12:51.475: W/Bundle(7178): 	at android.os.Looper.loop(Looper.java:130)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
11-29 23:12:51.475: W/Bundle(7178): 	at java.lang.reflect.Method.invokeNative(Native Method)
11-29 23:12:51.475: W/Bundle(7178): 	at java.lang.reflect.Method.invoke(Method.java:507)
11-29 23:12:51.475: W/Bundle(7178): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-29 23:12:51.475: W/Bundle(7178): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-29 23:12:51.475: W/Bundle(7178): 	at dalvik.system.NativeStart.main(Native Method)
11-29 23:12:51.475: W/Bundle(7178): Key android.intent.extra.CC expected String[] but value was a java.lang.String.  The default value <null> was returned.
11-29 23:12:51.475: W/Bundle(7178): Attempt to cast generated internal exception:
11-29 23:12:51.475: W/Bundle(7178): java.lang.ClassCastException: java.lang.String
11-29 23:12:51.475: W/Bundle(7178): 	at android.os.Bundle.getStringArray(Bundle.java:1459)
11-29 23:12:51.475: W/Bundle(7178): 	at android.content.Intent.getStringArrayExtra(Intent.java:3630)
11-29 23:12:51.475: W/Bundle(7178): 	at com.google.android.gm.ComposeArea.initFromExtras(ComposeArea.java:624)
11-29 23:12:51.475: W/Bundle(7178): 	at com.google.android.gm.ComposeActivity.initFromExtras(ComposeActivity.java:1482)
11-29 23:12:51.475: W/Bundle(7178): 	at com.google.android.gm.ComposeActivity.finishOnCreateAfterAccountSelected(ComposeActivity.java:1020)
11-29 23:12:51.475: W/Bundle(7178): 	at com.google.android.gm.ComposeActivity.onCreate(ComposeActivity.java:259)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-29 23:12:51.475: W/Bundle(7178): 	at android.os.Handler.dispatchMessage(Handler.java:99)
11-29 23:12:51.475: W/Bundle(7178): 	at android.os.Looper.loop(Looper.java:130)
11-29 23:12:51.475: W/Bundle(7178): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
11-29 23:12:51.475: W/Bundle(7178): 	at java.lang.reflect.Method.invokeNative(Native Method)
11-29 23:12:51.475: W/Bundle(7178): 	at java.lang.reflect.Method.invoke(Method.java:507)
11-29 23:12:51.475: W/Bundle(7178): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-29 23:12:51.475: W/Bundle(7178): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-29 23:12:51.475: W/Bundle(7178): 	at dalvik.system.NativeStart.main(Native Method)
11-29 23:12:51.485: I/ActivityManager(96): Start proc android.process.acore for content provider com.android.providers.contacts/.ContactsProvider2: pid=7193 uid=10006 gids={3003, 1015}
11-29 23:12:51.595: I/ActivityThread(7193): Pub user_dictionary: com.android.providers.userdictionary.UserDictionaryProvider
11-29 23:12:51.615: I/ActivityThread(7193): Pub com.android.social: com.android.providers.contacts.SocialProvider
11-29 23:12:51.615: I/ActivityThread(7193): Pub applications: com.android.providers.applications.ApplicationsProvider
11-29 23:12:51.685: I/ActivityThread(7193): Pub contacts;com.android.contacts: com.android.providers.contacts.ContactsProvider2
11-29 23:12:51.875: I/ActivityManager(96): Displayed com.google.android.gm/.ComposeActivity: +1s103ms (total +1s402ms)
11-29 23:12:52.045: D/dalvikvm(167): GC_EXTERNAL_ALLOC freed 76K, 51% free 3112K/6343K, external 4674K/5001K, paused 139ms
11-29 23:12:52.785: I/ActivityThread(7193): Pub call_log: com.android.providers.contacts.CallLogProvider
11-29 23:12:53.005: D/szipinf(7193): Initializing inflate state
11-29 23:12:56.595: D/dalvikvm(7178): GC_EXTERNAL_ALLOC freed 433K, 51% free 3033K/6087K, external 2074K/2137K, paused 54ms
11-29 23:12:59.425: W/KeyCharacterMap(7178): No keyboard for id 131074
11-29 23:12:59.425: W/KeyCharacterMap(7178): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
11-29 23:12:59.555: W/InputManagerService(96): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40828398
11-29 23:13:14.035: D/dalvikvm(6468): GC_EXPLICIT freed 8K, 49% free 3501K/6855K, external 1625K/2137K, paused 56ms

Step o reproduces

Click on button share button

And Check "TO" input field

Attachments

FileDateSize
device-2013-11-29-232130.png2013-11-29T17:40:03.000+000051055

Comments

  1. Biju pm 2013-12-18

    PR : - https://github.com/appcelerator/titanium_mobile/pull/5144
  2. Paras Mishra 2014-06-20

    EXTRA_EMAIL property is working as expected. Closing as fixed Verified the fixed on: Tested on: Device: LG-P970, Android version: 4.0.4 SDK: 3.3.0.v20140619164112 CLI version : 3.3.0-rc OS : MAC OSX 10.9.2 Alloy: 1.4.0-rc ACS: 1.0.14 npm:1.3.2 LiveView: 1.0.4 Appcelerator Studio, build: 3.3.0.201406171619 titanium-code-processor: 1.1.1 XCode : 5.1.1

JSON Source