Inserting an image into a Telegram bot message - java

i need help with sending the image along with the SendMessage entity.
I need help with sending the image along with the SendMessage entity. I tried to do it through markdown markup, but it doesn't work - the image is displayed as a preview and the link is also visible.
sendMessage.enableMarkdown(true);
sendMessage.setText("<image src=\"https://info-master.su/programming/web/html/images/images-in-html.jpg\" alt=\"Текст с описанием картинки\">")
result
https://disk.yandex.ru/i/8ibJJVBAaVNrUQ
how do I make exactly an embedded image, without a link, please help me

Related

How to hide paramters in url while displaying Birt report

I am calling the report from my application in JSF the connection parameters are captured by the application and sent to the Birt, the only problem and that parameters are visible in the address bar.
is there any way to hide them or encrypt them?
I need this because the data may come from applications with different connections.
I am using
window.open(
http://localhost:8081/birt5/run?__report=Report/Bound_Polici es_Report.rptdesign&Report_StartDate=05/20/2018&Repo rt_EndDate=05/30/2018&Report_InsuranceCompanyId=0&Re port_DomicileState=New+Mexico&Report_InsuranceCarrierId= 0&Report_BusinessType=All&__format=html&__title= Compquick
)
to load the new report.
Is there any solution to hide paramters if my requirement is that the Report
should open in new when I click on submit button in one JSF.
I would appreciate any help you could give. Thanks :)

Is there a way to show a video in a remoteview notification on Android?

I'm working in a notification app for Android and my customer has requested me to insert a video inside the notification preview.
I know that I'm able to create notifications with pictures and notifications with custom views, but when I try to add a video to the custom view my app gives me always this error:
FATAL EXCEPTION: main
Bad notification posted from package com.codeversed.example.Notifications: Couldn't expand RemoteViews for: StatusBarNotification(pkg=com.codeversed.example.Notifications user=UserHandle{0} id=0 tag=null score=0 key=0|com.codeversed.example.Notifications|0|null|10008: Notification(pri=0 contentView=com.codeversed.example.Notifications/0x1090089 vibrate=default sound=default defaults=0x7 flags=0x18 color=0x00000000 originalPackageName=N originalUserId=0 vis=PRIVATE))
I suppose that is it because videos aren't allowed to remote views. Does somebody know if this limitation can be sorted or if there is a way to show videos on notifications?
Regards,
No, you cannot show a video in a Notification. Partially, that is because RemoteViews does not support a SurfaceView, TextureView, or VideoView that you would need. Partially, that is because the party responsible for showing the video may not have rights to do so (e.g., may not have Internet access). Remember that you are not the one actually showing the Notification — somebody else is. You merely provide the specification.

Size of Facebook Event Picture

I am trying to fetch the information of a facebook event using a request by the Facebook SDK for Android, but I am getting a small image. The fetching procedure is done as follows:
params.putString("fields", "id,name,picture");
mAsyncRunner.request("me/events",params, new RequestListener() {.....
But the link to the JPG image is very small. Is there any way to get a better resolution of this image?
Once you know the EVENT_ID for a particular event, you can send a graph request to "EVENT_ID/picture?type=SIZE" where SIZE=small | normal | large.

Wrong picture on FB Wall, feed post from android app (android FB sdk)

I have a problem with Feed post Picture, we decided to change our (android native) FB App icon, so we changed this icon at all occurrences in FB app settings, and we changed the picture on ftp server(on which we refferenced when posting feed from app).
But when I post feed from app (in the feed dialog there is a correct picture), on wall in browser there is wrong(old) picture, weird is when I check my wall from katana(facebook android app), there is a correct picture. Size of picture is 512x512 and it's png format.
I'm talking about picture besides the feed (not small icon under feed)
Sample of feed post:
...
Bundle parameters = new Bundle();
parameters.putString("picture", path_tou_our_icon_on_ftp_server_in_png_fromat);
parameters.putString("name", facebookMsgName);
parameters.putString("caption", facebookMsgCaption);
parameters.putString("description", facebook_message);
parameters.putString("link", "http://bit.ly/....");
facebook.dialog(mInstance, "feed", parameters,....
Add "?cache=" + System.currentTimeMillis(); to your image URL posted to FB.
The reason for this is because facebook are probably caching your image. There are two solutions:
Give the new image a different name and update your code to use it. This will force facebook to use the new image, but it means you have to get a update for you app through the App Store, or
Wait for Facebook to update it's cache and start using the correct new image.

How to track an email in Java?

How I can track an email?
I' m using java on the server side for sending emails. I want to track whether it is delivered , opened, etc... How I can do that ?
This is not a Java specific issue.
You can create an HTML email, and embed an invisible gif which will report back to your server. Some software like Outlook and some web mail programs will block this for untrusted emails.
You can request a return receipt. Many mail programs ignore this entirely, and the ones which don't usually ask the user if they want to send it.
Example:
email.AddHeaderField("Disposition-Notification-To","<g.revolution#stackoverflow.com>")
There is no way to ensure that you always get the delivery or open-message notification.
Mailservers may accept the mail and drop it afterwards.
users may read the mail but dismiss the notification.
"Webbugs" (aka images in the html source of the mail that include a special token that allows the mail to be recognized) don't work in most email programs.
As a matter of fact it's very unlikely that you can see that someone got the message.
What you could do is to keep the message on your server and only send a link. If the user clicks that you can be pretty sure that he got the message. But thankfully many users would not click on such links because it's used in fraud and spam.
I suppose you're sending it through SMTP. Whenever your mail is sent to your SMTP server, your java program has no control of it:
1) If you want to know if your mail has been delivered, you should contact your SMTP server somehow (if the SMTP server is outside your control then forget that) and see if your mail has been sent.
2) You can't know if a mail has been opened by its receiver. The maximum you can do is set a flag that the mail requires acknowledgement, but that depends if the user explicitly wants to send that acknowledgment. Other possibility is set some link to your site within the mail that should be clicked to see the content. You will be able to track if the user clicked that link.
what you can do is -
you have to embed an invisible image in the body in which the src will call the page in server and log that event, you can only do it in HTML encoding.
example -
<img src="ImageServer.aspx?imageID=track.jpg& custID=134ghxx34343ai& campID=32434"/>
and then in ImageServer.aspx there will a handling code which will log that event or save it to database.
example -
private void Page_Load(object sender, System.EventArgs e)
{
// content type should be resolved programmatically
Response.ContentType = "image/jpeg";
if (!IsPostBack) Track();
Response.WriteFile(GetImageFileByID());
}
In case you send HTML email, you could add a 1x1 pixel image with some tracking parameters, that calls back to your webserver. It's not 100% reliable since some email clients (and users) block images in emails.
You can add something like
<span style="display:none">Tracking no: ${TRACK_NO}</span>
to the body of the email. This should always be in the response unless the email client strips it out.

Categories