MonacaでSocialSharing-PhoneGap-Pluginを使用して、メール送信に関する処理を書いています。
メール送信が完了した場合「送信完了」、メール送信画面まで行ってキャンセルした場合は「送信キャンセル」というアラートを出したく、プラグインのEmail項目にonSuccessとonErrorのパラメーターがあるようでしたので、それを参考に以下のように記述してみました。
window.plugins.socialsharing.shareViaEmail( 'メッセージ内容', '件名', ['aaa@aaa.com', 'iii@iii.com'], ['uuu@uuu.com'], null, null, function() {alert('送信完了');}, function() {alert('送信キャンセル');} );
プラグインページ抜粋↓
window.plugins.socialsharing.shareViaEmail( 'Message', // can contain HTML tags, but support on Android is rather limited: http://stackoverflow.com/questions/15136480/how-to-send-html-content-with-image-through-android-default-email-client 'Subject', ['to@person1.com', 'to@person2.com'], // TO: must be null or an array ['cc@person1.com'], // CC: must be null or an array null, // BCC: must be null or an array ['https://www.google.nl/images/srpr/logo4w.png','www/localimage.png'], // FILES: can be null, a string, or an array onSuccess, // called when sharing worked, but also when the user cancelled sharing via email. On iOS, the callbacks' boolean result parameter is true when sharing worked, false if cancelled. On Android, this parameter is always true so it can't be used). See section "Notes about the successCallback" below. onError // called when sh*t hits the fan );
iPhoneにデバッグビルドをしたアプリを入れて実行させるとメール作成画面が立ち上がり、そのまま送信しても、途中でキャンセル(メール画面を閉じる)しても、どちらも「送信完了」というアラートが出て、振り分けができません。
onSuccessとonErrorが、そもそもそうした用途用にあるパラメーターなのか、その場合、上記要件を満たすにはどのように記述したらいいか、お知恵お借りできればと思います。よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/12 12:51