I wants to send an image stored in the drawable folder to some other app using ACTION_SEND ,my code is given below:
if(view.getId()==R.id.sendimage) {
Uri imageUri=Uri.parse("android.resource://"+getPackageName()+"/drawable"+R.drawable.screen);
intent=new Intent(Intent.ACTION_SEND); intent.setType("image/*");
intent.putExtra(Intent.EXTRA_STREAM,imageUri);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
chooser=intent.createChooser(intent,"Send Image Via");
startActivity(chooser);
}
But when i try to send using button in my app to Gmail a toast message "Can't attach empty file " appears and similar message also appear in other apps too while sending and some app even crashes.
So could you please help me in figuring out the mistake??
Related
This is the code for messageCreate event that I wrote:
And in the discord app I am getting the response of the console log for no attachments even though I have tried sending images text and audio files:
You're most likely missing the MESSAGE_CONTENT intent.
Go to https://discord.com/developers/applications/ and enable the Message Content Intent in the Bot section.
Image for reference: https://i.imgur.com/mi8XMZb.jpg
Also make sure to add the GatewayIntentBits.MessageContent when you define your client.
I'm using Twilio functions (Node) to connect to other service endpoint, messages content works smooth, but the problem I have is because I can't catch image URL to send it.
If I watch "Programmable Messaging"/"Logs/"Message Details" I see image correctly.
In "Studio"/"Webchat Flow" on Trigger/incoming message, I set the variables, according with documentation, image URL come in variable trigger.message.MediaUrl0...1...2... But... Variable content it's allways empty. I try with other variables, even I log "trigger" directly:
"{message={EventType=onMessageSent, InstanceSid=***********, Attributes={\"proxied\":true}, DateCreated=2020-10-15T13:47:35.945Z, Index=156, From=whatsapp_********, MessageSid=*****************, Source=API, AccountSid=*******************, ChannelSid=*********, RetryCount=0, WebhookType=studio, To=**********, Body=, ChannelAttributes={status=ACTIVE, long_lived=false, forwarding=true, serviceNumber=whatsapp_txmo0zqebp5s5kmxt5ivs7ofuyhgxpdl, twilioNumber=whatsapp:+TWILIO_NUMBER, from=whatsapp:+MYNUMBER, channel_type=whatsapp, proxySession=****************}, WebhookSid=*************}}"
What I'm doing wrong?
Kind regads
I have a firebase and few audio files on him, and I have the download url.
I want to send the audio file on whatsapp, how can I do this?
I wrote this:
Intent whatsappIntent = new Intent(Intent.ACTION_SEND);
whatsappIntent.setType("audio/*");
whatsappIntent.setPackage("com.whatsapp");
whatsappIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(audioUrl));
try {
context.startActivity(whatsappIntent);
} catch (android.content.ActivityNotFoundException ex) {
//ToastHelper.MakeShortText("Whatsapp have not been installed.");
}
and when I choose who I want to send him I got this error: Failed to share
How can I fix that?
EDIT:
The error said: "Failed to share" and I see it on the screen like toast message.
I'm developing a chatbot on azure using node.js. It's a data visualization bot which generates chart in html format using d3 library and display to user.
It seems that Microsoft bot builder doesn't support html format. But I have looked through this link:
https://blog.botframework.com/2017/09/07/html-not-supported-web-chat/
It says that there is a way to enable html content:
"If HTML rendering in Web Chat is a critical feature for your applications, you can clone or fork a copy of the Web Chat source code from GitHub, and enable it (on your own custom Web Chat client)."
I tried to clone the file and changed ‘html : false’ to ‘html : true’. But it's not working.
Can anyone tell me what I can do? Really appreciate it!!!
Depending on what data you are attempting to visualize, you might be able to use a service like Google Image Charts: https://developers.google.com/chart/image/docs/chart_playground
Using this service, with the following code:
// attach the card to the reply message
var msg = new builder.Message(session).addAttachment(createHeroCard(session));
session.send(msg);
function createHeroCard(session) {
return new builder.HeroCard(session)
.title('Months with Numbers Bar Chart')
.subtitle('Using a Chart as Image service...')
.text('Build and connect intelligent bots that have charts rendered as images.')
.images([
builder.CardImage.create(session, 'http://chart.googleapis.com/chart?cht=bvg&chs=250x150&chd=s:Monkeys&chxt=x,y&chxl=0:|Jan|Feb|Mar|Apr|May|Jun|Jul')
])
.buttons([
builder.CardAction.openUrl(session, 'https://learn.microsoft.com/bot-framework/', 'Get Started')
]);
}
Produces this hero card:
I am working with Xamarin UWP along with Azure notification hub to send Push notifications. I have the toast notifications showing up just fine, but when I click on the toast I need to be able to view the message. I can get a message to show up from the OnLaunched method when the notification is touched, with something like this:
string text = string.Format("Launched with parameter: " + args.ToString());
MessageDialog dialog = new MessageDialog(text);
await dialog.ShowAsync();
I can't figure out how to retrieve the message that was sent from the toast notification.
I ended up setting my text in the launch parameter to receive it in OnActivated