Getting no application can do this action on Android while using Codename One share button - share

My Codename One app features a ShareButton that is used like this :
// Share this report on social networks (text plus screenshot)
ShareButton shareReportButton = new ShareButton();
shareReportButton.setText("Share this report!");
shareReportButton.getAllStyles().setBorder(
RoundBorder.create().rectangle(true));
FontImage.setMaterialIcon(shareReportButton, FontImage.MATERIAL_SHARE);
shareReportButton.getStyle().setBgColor(ParametresGeneraux.accentColor);
shareReportButton.getPressedStyle().setBgColor(ParametresGeneraux.darkPrimaryColor);
shareReportButton.setTextToShare("I reported this via the great app ABCD "!"
);
shareReportButton.setImageToShare(currentReport.getPhotoPath(), ImageIO.FORMAT_PNG);
I works as expected under the simulator but on an actual Android 4.4 device I get a Dialog menu with "No app can do this action".
Please note that it is possible to share eg a photo with the native apps.
I could not find any build hint to add in the doc. What should I do to make the share button offer a way to share a text + photo on the social networks ?
Any help appreciated,
Regards
EDIT
Following #James H and #Diamond answers, the image type has to be set as mime type. Consequently replacing ImageIO.FORMAT_PNG by "image/jpg" makes the share menu populated.
For completeness please notice that as stated in the doc
an image must be stored using the FileSystemStorage API and shouldn't use a different API like Storage!
So even if the photo is in the cache you have to copy it eg to your home folder and then use this copied version in the ShareButton.

I think the problem might be that
setImageToShare(String imagePath, String imageMimeType)
is looking for a Mime description with a different format, such as: "image/png"
I'm not sure that ImageIO.FORMAT_PNG works in this way. Looking at the sample in the JavaDoc, it uses:
sb.setImageToShare(imageFile, "image/png");

Use the native share functionality and check if sharing natively is support by doing the following:
// Share this report on social networks (text plus screenshot)
Button shareReportButton = new Button("Share this report!");
shareReportButton.getAllStyles().setBorder(create().rectangle(true));
FontImage.setMaterialIcon(shareReportButton, FontImage.MATERIAL_SHARE);
shareReportButton.getStyle().setBgColor(ParametresGeneraux.accentColor);
shareReportButton.getPressedStyle().setBgColor(ParametresGeneraux.darkPrimaryColor);
shareReportButton.addActionListener(e -> {
if (Display.getInstance().isNativeShareSupported()) {
Display.getInstance().share("I reported this via the great app ABCD ", currentReport.getPhotoPath(), "image/png"); // Or "image/jpg"
} else {
ToastBar.showErrorMessage("Your phone doesn't support sharing...");
}
});

Related

I want to add Share to Slack feature in my web app. Facing issue in showing the popup to select the receipients

I am adding share to slack functionality in my web app.
But I cannot find any solution by which I can show my app users to select a user/channel or team in slack to share the content with.
I have added Sharing on Teams also. In that I am able to select the users or search the particular user. Please refer the below link to see how it is looking in teams.
https://learn.microsoft.com/de-de/power-bi/collaborate-share/media/service-share-report-teams/service-teams-share-to-teams-dialog.png
I want to know, is there any way by which we can implement the sharing to particular user or channel etc on slack same as it is there in teams.
Thanks.
Once the Web app shares content, it's very much up to the receiving app to decide what it makes of the incoming data.
try {
await navigator.share({
title: 'Title',
text: 'Text',
url: 'https://example.com/',
});
console.log('Successful share'))
} catch (err) {
console.log('Error sharing', err));
}
Possible values are:
url: A string representing a URL to be shared.
text: A string representing text to be shared.
title: A string representing a title to be shared. May be ignored by the target.
See the bold part. Try populating text and title differently and see if it makes any difference.

Google Action prompt link url on Webhook response not working as expected

I am trying to add a prompt link to my Google Action:
https://developers.google.com/assistant/conversational/reference/rest/v1/TopLevel/fulfill#link
My response looks like this:
payload.prompt.link = {
name: 'Open My Website',
open: {
url: 'https://mywebsite.com'
}
}
When testing on my Nest Hub, the link does show as a suggestion on the bottom of the page. However, when I click on it, it simply sends it as an utterance to my Action instead of open the web page.
Any idea why this is happening? And what is the expected behavior for prompt links? I cannot find much documentation on them.
This appears to be the Actions Builder implementation of Link-Out Suggestions, which were not originally available when the Actions Builder was released. They were, however, available for Dialogflow previously.
Link-Out Suggestions require the "WEB_LINK" device capability to work. Smart Displays do not have this device capability.

Avatars grabbed by discord.py bot not loading on mobile

In every command and embed that i have that uses the avatar_url, the image is not loading on iphone. This includes thumbnails and icons of embeds as well as just the embed image. I have no idea what it is and I've been told that it's a discord issue and that it cannot be fixed but I came here just in case. I asked a few friends on iphone if it was working for them either and it wasn't so it's not just me that my bot's images aren't loading for but it works perfectly on desktop.
Here's my profile picture command code for enlarging profile pictures in case it's something in the code that i'm just not seeing that could affect it in anyway idk.
async def pfp(ctx, member : discord.Member = None):
" :Shows targeted user's avatar/profile picture."
member = ctx.author if not member else member
embed = discord.Embed(
title = f"**{member.name}'s Profile Picture**",
color = discord.Color.green()
)
embed.set_image(url='{}'.format(member.avatar_url))
await ctx.send(embed=embed)```
I had the same issue except in discord.js - try avatar_url() - it fixed mine.
Slightly different syntax so apologies if this is incorrect

Creating branch links from iOS that shows the same values as dashboard link

Product team already created a quick link on dashboard, and it already has a Title, Description, and ImageURL. It's something like this https://myapp.app.link/ticket
I am showing tickets on my iOS application. Whenever user selects share option on a ticket, I am using below code to populate iOS share sheet
let buo = BranchUniversalObject(canonicalIdentifier: "ticket/id?=" + ticketId)
buo.contentMetadata.customMetadata["id"] = ticketId
buo.publiclyIndex = true
buo.locallyIndex = true
let lp: BranchLinkProperties = BranchLinkProperties()
lp.addControlParam("channel", withValue: "app")
lp.addControlParam("feature", withValue: "ticket_share")
lp.addControlParam("$deeplink_path", withValue: "ticket/?id=" + ticketId)
buo.showShareSheet(with: lp, andShareText: message, from: viewController, completion: nil)
When I share this link, it appears something like https://myapp.app.link/RANDOMNUMBERS and I don't see the Title, Description, or ImageURL that are set at branch dashboard.
How can I create a URL using BranchUniversalObject and BranchLinkProperties that fits the one on dashboard (so something like this https://myapp.app.link/ticket?id=123123) and shows the correct Title, Description, and ImageURL?
Edit: When I try to add lp.alias = "ticket" I am getting below error from branch sdk
Error Domain=io.branch.sdk.error Code=1001 "A resource with this identifier already exists."
I don't want to push a new version of the app everytime we want to change shared description or image, that's why I want to use existing created link on branch dashboard
You don't have to update your app each time social media tags such as title or image are updated. You can do this per link basis (https://dashboard.branch.io/quick-links/qlc/config/ under Social Media tab) or globally on link settings: https://dashboard.branch.io/link-settings/general. Alternatively, you can add the following OG tags in the link data when creating links via the SDK or API: $og_title, $og_description, $og_image_url. More info on this: https://docs.branch.io/activity-reports-analytics/content-analytics/#how-does-branch-identify-my-content

Facebook graph user picture won't show on mobile devices

I use the url https://graph.facebook.com/{app_user_id}/picture?width=120&height=120 to show the user picture on my app, but since this morning, it has stopped working on mobile devices.
Now, the same url redirects to https://lookaside.facebook.com/platform/profilepic/?asid={app_user_id}&height=120&width=120. This url works on desktop web, but on mobile it redirects again to https://m.facebook.com/platform/profilepic/?asid={app_user_id}&height=120&width=120 and the mobile web refuses to output the image. If I try to load it in the address bar, it is downloaded instead of showed.
I have searched for any change on the Facebook graph api about this but didn't find anything. Any hint to solve this? Thanks.
This seems to be a bug. Started happening to my app earlier on this morning. Still no fix as of yet.
A few bug reports that have been submitted on Facebook for Developers:
Profile Pictures Can't Load
Graph API Profile picture doesn`t work on mobile
Cross site policy error while accessing graph pictures
I faced the same issue today and I'v found a solution for that and it worked for me.
After login we get below Profile pic URL
http://graph.facebook.com/11111111111/picture?type=large&height=320&width=420
11111111111 is your social id/facebook id
now we need to change this URL in order to display image,
here is the code.
try {
profile_pic = new URL("https://graph.facebook.com/" + id + "/picture?type=large");
Log.i("profile_pic", profile_pic + "");
Picasso.with(getContext()).
load(profile_pic.toString())
.placeholder(R.drawable.img)
.into(imageviewId);
}
catch (MalformedURLException e) {
e.printStackTrace();
}
id is your socialid/facebook id
in short we just need to remove &height=320&width=420 from url.
you can compare both the url:
http://graph.facebook.com/11111111111/picture?type=large&height=320&width=420
https://graph.facebook.com/11111111111/picture?type=large
and yes you need to change http to https as well
Though I didn't find any official announcements, Facebook during last few days changed their api's, now when you request user's public profile the picture url has extra parameters, ext and hash
Calling the url without these params returns 404 error.
Not sure if the change is affecting Page Scope ID's only.
Currently, when you request user's public profile data the url looks like this
https://lookaside.facebook.com/platform/profilepic/?psid=PAGE_SCOPED_ID&height=1024&ext=1522585606&hash=AeThc8c7EQDFgShs
before it was just
https://lookaside.facebook.com/platform/profilepic/?psid=PAGE_SCOPED_ID&height=1024
It seems to me the only known solution currently would be requesting new public profile data and updating your database.
Hope that helps.