Hi I am trying to share some text and image, I use many snnipes of this forum but nothing works. Mi code is the next one:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("image/png");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "testing email send.");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://com.tortilla.patatapro/drawable/" + Integer.toString(R.drawable.ic_home)));
startActivity(emailIntent);
First it seems that was so easy, but the problem is that when I Share my app with the gmail app and it sends the image and only the subject of the email, then when I open the email the image haven´t got an extension. For example if the image was ic_home.png when I open the email it was something attached with a name like 239378437892 but without extension so the email reader (gmail, hotmail...) doesn´t know what was.
I try to change the code like:
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://com.tortilla.patatapro/drawable/" + R.drawable.ic_home));
or
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://com.tortilla.patatapro/drawable/"+ R.drawable.ic_home + ".png"));
But nothing the email from GMAIL app sends the image without extension, and of course the image was a .png extension.
THANKS!
Related
I'm trying to upload selected image by MIT App Inventor II. What I did is to download an extension which encodes image to base64 coding, and then call Web1 to address Google App Script. Actually, what I did is just follow an YouTube channel, but somehow it does not work.
function doPost(e) {
var data = Utilities.base64Decode(e.parameters.data);
var blob = Utilities.newBlob(data,e.parameters.mimetype,e.parameters.filename);
var folderid = Utilities.base64Decode(e.parameters.folderid);
DriveApp.getFileById(folderid).createFile(blob);
return ContentService.createTextOutput("Your File Successfuly Uploaded");
}
Combining with Taifun's Extension. These blocks are confirmed to be able to do as below.
Display the ImagePicker selected image on the Image component
Encode the ImagePicker selected image to a Base64 string.
Send the string to URL (Google App Script)
I'm creating a bot that allows users to create embedded messages. Here is a command that I am working with:
#bot.command()
async def embed(ctx,title_str,text_str,url_str):
embed=discord.Embed(title=title_str, url=url_str, description=text_str, color=0xFF5733)
await ctx.send(embed=embed)
This works fine, but if a video is linked I'd like it to add a preview image - in the same way it does if you post a Youtube link I tried adding image = video_url to the discord.Embed command, but this did not help.
Clearly discord is able to do this because when you type in a url to a video you get a preview in an embed automatically generated.
Per the Discord API docs: "For the embed object, you can set every field except type (it will be rich regardless of if you try to set it), provider, video, and any height, width, or proxy_url values for images."
Therefore, you cannot assign a video to Embeds via the API.
See: https://discord.com/developers/docs/resources/channel#create-message
I trying to create a whatsapp status saver in flutter. I trying to save the whatsapp status. I created a folder statuses in /storage/emulated/0/statuses/ and The process of copying goes well. But that Image is not shown in the gallery app.
So I even Tried storing it in DCIM/Camera still it doesn't show up there. But when the copy the same image using file explorer then that image shows up in gallery app. I think something is wrong with the image properties.
The code used to save is here.
saveFile(filePath) async {
String newFilename;
File originalFile = File(filePath);
Directory _directory = await getExternalStorageDirectory();
if (!Directory("/storage/emulated/0/statuses/").existsSync()) {
Directory("/storage/emulated/0/statuses/")
.createSync(recursive: false);
}
String curDate = DateTime.now().toString();
newFilename = "/storage/emulated/0/statuses/VIDEO-$curDate.jpg";
await originalFile.copy(newFilename).then((value) {
print("Saved: " + newFilename);
});
}
When you change a media, you should tell the device to re-scan. This image saver plugin will notify the Android OS about the media that is saved.
If you don't want the plugin, you can use platform channels to write native code yourself.
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + Environment.getExternalStorageDirectory())));
This issue is discussed here and here.
My app uses Google API client library for .NET to send emails with attachments.
When using Send(), I'm facing some limitations when it comes to file size of the attachments. So, I guess switching to Resumable upload as upload method may help. But it's pretty much undocumented.
Looking into source code, I guess using different Send() overload may be the way forward, but I can't figure out how to use it properly.
So, instead of attaching the files into message and calling it like this:
var gmailResult = gmail.Users.Messages.Send(new Message
{
Raw = base64UrlEncodedMessage
}, "me").Execute();
I should not attach the files to message and do something like following?
var gmailResult = gmail.Users.Messages.Send(new Message
{
Raw = base64UrlEncodedMessage
}, "me", fileStream, contentType).Upload();
The second version does not return any API error, but does nothing. I'm obviously missing something here.
How do I attach more than one attachment?
This is kind of an old question, but putting an answer here just in case anyone else needs it:
I was able to achieve this by converting my mime message into a stream (attachment(s) included), and then calling this overload on Send:
UsersResource.MessagesResource.SendMediaUpload googleSendRequest = service.Users.Messages.Send(null, "youremail#gmail.com", mimeMessageStream, "message/rfc822");
IUploadProgress created = googleSendRequest.Upload();
This will upload all of the attachments with the email message content and then send it off. I was able to send two 5 megabyte attachments in an email. Previously I was not able to send even one of those via the other Send method that takes in a base64 encoded mime message.
I'm making an app and I want to be able to go from my app to the messaging app straight to the "Create new" page. Is there a way I can navigate to that page straight from my app?
As Andrew M mentioned, the SmsComposeTask is the correct control to use. Here is some sample code for you:
SmsComposeTask smsTask = new SmsComposeTask();
smsTask.To = "0123456789"; // the number you would like to send the sms to
smsTask.Body = "Some prefilled text..."; // if you would like to fill some text
smsTask.Show();
When Show() is called, the app will navigate to the Messaging application and display an SMS filled in with the defined parameters.
Simply use the above code in an event handler (i.e., the event for when a button is clicked), and the user will be navigated accordingly.
Use the SMSComposeTask:
http://www.nickharris.net/2010/09/how-to-sms-using-the-smscomposetask-for-windows-phone-7/