How to send product details(image & text) as url by a click on Android Share icon - android-sharing

Do android apps require a website? I'm working on an real time android market app and wanted users to share product details and its image using android share icon but I don't know how to share that information as url coz my app is not a web app its just an android app.
Image is as shown
I wanted to share the image and data(e.gtable and 50000) using my sharing options
For possible solutions that I have come across is getting url for the product and sharing it but I also realised that most apps that use this option have a website where they can get a shareble url from,as shown
but my issue with this solution is my app doesn't have a web app/website, because it is purely android app, will I be required to have a web app/website in order to get a sharerable url? or is there an option of sharing this data?
This is what I have for my sharing button, sending out hardcoded text via code:
else if (id == R.id.action_share) {
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBodyText = "Check it out this product";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBodyText);
startActivity(Intent.createChooser(sharingIntent, "Shearing Option"));
return true;
}

Related

How iOS URL Scheme work with a https website

I was developing an iOS application which need to work with a website. I'm not the owner of website so I cant use the universal link. I tried to open the website url https://example.com/xxx/xxx directly when I set the https://example.com/xxx/xxx as URL Scheme , however it will only display the website but won't asked for open the apps. What is the problem and can I do to achieve the expectation below?
Expectation:
When the user open the website
Phone w/ app - open the website and ask for open the app
Phone w/o app - open the website
I have similar problem with this question.
iOS URL scheme or not existing Universal Link
If you don't own the website you want to deep link to, you can't dictate the behavior once the user lands on that destination in their browser – that would need to be handled by that website.

How to share URL using Xamarin iOS

I'm developing an app for my local newspaper. When you press the "Share" button, I want the standard iOS share interface to appear allowing users to share the URL of an article with Facebook, Twitter, etc. I'm trying to use the UIActivityViewController, and while it appears, it's not giving me all of the options.
Here's the code I use:
NSObject[] activitiesItems = {
new NSString(post.Title),
new NSUrl(post.URL)
};
var activityController = new UIActivityViewController(activitiesItems, null);
PresentViewController(activityController, true, null);
When the UI opens, this is all I see (no Twitter or Facebook):
This is in comparison to what I see when I share a page from Safari, which has the Facebook and Twitter options, along with a variety of others:
What do I have to change in my code to allow more of these options to appear?
1) Your code is fine
2) On your iOS Simulator go to the Setting and login to Twitter and/or FaceBook accounts and retest your app.
iOS Simulator Setting (botton off screen):
Here is my Simulator view with me logged into Twitter but not Facebook using the same code you posted:
3) Safari is a using a custom ViewController to display what you are seeing... If you actually try to share a link via that Twitter button you will be force to login..
4) Use an actual device for complete testing of all the possible sharing applications installed.
Those options are only supposed to show when you are logged in to an account in the Settings app for FB and Twitter. They are hidden if not.
However that doesn't really explain why they show up in Safari.
Perhaps including the NSString for post.Title in the items array is causing it to exclude some sharing options.

Facebook App Links Mobile Hosted API doesn' t detect installed app iOS

I am trying to implement Facebook App Links using the Mobile Hosted API. Everything goes smoothly but when I test the App Link URL the app doesn't open even if installed and the URL redirects to the App Store. The custom URL for my app is set properly as when I type the custom scheme inside Safari it does open the app. It seems that something is off but can't tell why.
Here is some data:
The url that I test in the browser is:
http://fb.me/780961121977733
This is the registered data with the Mobile Hosted API:
{
id = 780961121977733;
ios =(
{
"app_name" = GoPhrazy;
"app_store_id" = 903559056;
url = "gophrazy://playerPuzzle/leo3/1420663071896";
}
);
}
The custom url scheme is registered in the info.plist as:
gophrazy://
I thought maybe the app_name case would affect it but I tested that to all lower with no effect.
Anyone has any tips on this?
Thanks
Url scheme in the info.plist MUST be always defined without leading ://

Web-apps: Can the iOS share sheet be triggered – and/or the shared URL customised – programatically?

Specifically, I would like to share granular page content via triggering the iOS share sheet with in-page buttons.
In my webapp page, I have a table of downloadable PDFs. I would like to be able to add a column called "Share" into the table, so that a button could be tapped to share the URL to that document, without having to open the document itself and share from there.
In order to do this, I assume I would need to customise this triggered share sheet to share a different URL to the one that is showing in mobile safari's address bar.
Is this possible using javascript, or alternative URLs in a meta tag maybe? I don't expect URL scheme to be a solution, as it is concerned with sending data to another application.
Addendum 6/2020 It is possible since iOS 12.4, it works great.
It will be supported in Safari iOS V12.2. The beta of V12.2 already has it.
There's a good article by Maximiliano Firtman on a number of new features that will be possible in the new version.
Not currently on ios but a new w3c spec is on the way called web share api. Currently only available in chrome for android behind a origin trail.
https://developers.google.com/web/updates/2016/10/navigator-share
Yes, via the Web Share API
per the w3 docs:
shareButton.addEventListener("click", async () => {
try {
await navigator.share({ title: "Example Page", url: "" });
console.log("Data was shared successfully");
} catch (err) {
console.error("Share failed:", err.message);
}
});
Great article by Joe Medley on web.dev: Integrate with the OS sharing UI with the Web Share API

Create iOS link to an App in the app store - best way?

Here are my requirements:
1. Create links to a single app in the app store 2. Access the links either from inside an app, on the device generally (e.g. mail link) or from a PC (e.g. via facebook share link) 3. Open links using iPhone or iPad running iOS 5+
I have done some digging around and come up with the following options:
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=487547243
http://itunes.apple.com/gb/app/anyValue/id487547243?mt=8
http://itunes.com/apps/seligmanVenturesLtd/mouseTrapFree
http://itunes.com/apps/mouseTrapFree
itms://itunes.com/apps/mouseTrapFree
itms-apps://itunes.com/apps/mouseTrapFree
Just wondering if one (or some) of these are better than other?
Thanks.
Ok, so have done a lot of research/testing and here is my conclusion:
Links you use in your code should not rely on the 'current' name of you app, since this might change over time (e.g. Light Alarm Lite vs Light Alarm Free). Therefore the following 4 are out IMHO:
http://itunes.com/apps/seligmanVenturesLtd/mouseTrapFree
http://itunes.com/apps/mouseTrapFree
itms://itunes.com/apps/mouseTrapFree
itms-apps://itunes.com/apps/mouseTrapFree
That leaves itunes and phobos URLs. I have just tested both URLs via the iOS 6 share functionality (so this might be different on iOS 5, but given numbers are reducing daily for that I dont really mind). I tested accessing via SMS, Email, Facebook, Twitter (on an iPhone 5 and using a Mac).
Both url types produced near identical results, except for the following:
Phobos:
e.g. http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=346542660
+ None
- Sharing this link on facebook created a facebook link without any image... this was the showstopper for me that will mean I use iTunes urls going forward (see below).
iTunes
e.g. http://itunes.apple.com/gb/app/appName/id346542660?mt=8
+ When opening link on iphone 'Mail' app the app store opened within the 'Mail' app and no tabs along the bottom appeared, so arguably this creates increased focus on your app
- None
In summary, I will be going with itunes type urls going forward. eg:
e.g. http://itunes.apple.com/gb/app/appName/id346542660?mt=8
(Note: you don't have to stipulate the '/appName' in this url, just keeping it as '/appName/' works fine, which means you dont have to worry if you app name changes over time.
Cheers, Charlie
URL/Link to an app on the app store can be created very easily but there are several ways to achieve the end result. First of all we need to be clear on the purpose of the link (For ex. link might be used for Facebook posts or used inside an app for urging users to rate the app through in-app alerts/buttons). We can broadly categorize how we will use the link in 3 categories:
1. We want to use the link publicly outside the iOS (or OS X) domain. Means you can use this link to share on your Facebook wall or you want to embed the link in mail. I said outside iOS domain because your friends who doesn't have iPhone (or any other iOS device) or MacBook they might also use click that link from Facebook or their mail app/client.
2. We want to use the link inside iOS (or OS X) domain. Means when we are certain that our link will be clicked by device using iOS or OS X.
3. We want to send the app user (already a user of our app) to specific section (like review section) of the app on app store.
For category 1 and 2 it's best to use this type of URL:
https://itunes.apple.com/app/dots-a-game-about-connecting/id632285588?mt=8
When you embed this link then it can result in several outcomes:
If user clicks on this link from iPhone (from any iPhone app or mail app on iPhone): Your app page on App Store will open directly
If user clicks on this link from any Android Phone or Browser (Chrome/Safari/etc.): Your app page on itunes.apple.com website will open inside default browser. Even if you are opening it on you MacBook it won't open iTunes App Store but will display you app page in Browser itself.
Side Note: There are several places on web where below mentioned sort of link is also suggested:
http://appstore.com/dotsagameaboutconnecting
When you embed this link then it can result in several outcomes:
If user clicks on this link from iPhone or MacBook: Your app page on App Store will open directly. So this link is a bit better for MacBook users as it send users of MacBook directly to iTunes instead of staying within Safari browser.
If user clicks on this link from any Android Phone or Browser (Chrome/Safari/etc.): If user is clicking from PC that has iTunes installed then this link will open your app on iTunes else (on Android devices and PC that doesn't have iTunes) it will open a Apple.com page displaying "Download iTunes" without any mention of your app. Screenshot of that page below:
So If you are not sure about who will click on your link (outside/inside iOS domain) or If you want to be on safer side then I recommend first approach. Read here on how to create specific link for your app.
For category 3 simply use below code in some function/action:
NSString *myAppID = #"632285588";
NSString *url = [NSString stringWithFormat: #"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%#", myAppID];
//iOS7 doesn't approve above format so add iOS7 specific format
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
url = [NSString stringWithFormat: #"itms-apps://itunes.apple.com/app/id%#", myAppID];
}
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
For details on above code see this answer.
For developers who are developing first version of app and app is still not published on app store there is always a quandary about how to get the right link for your to be published app. For that:
Get your app ID from iTunesConnect. Use iTunesConnect to create your new app - give it a name, description, icon, screenshots, etc. Once app is created on iTunesConnect (without even submitting the app), you can get the Apple ID from the Identifiers section for the app.
You should not have any problems with the following one:
http://itunes.apple.com/gb/app/notebookpro/id<APP_ID>?mt=8
I believe, it will be opened on all major browsers/OS.
https://itunes.apple.com/app/id##app-id##?mt=8
Replace ##app-id## with real app-id.
For example:
https://itunes.apple.com/app/id346542660?mt=8
Summary
No country code. Ex: gb
No appName, only app-id.
https protocol.
I'm using the itms-apps: approach in our app, which also allows you to select to which "section" of your app the user will land.
So if you want to show them the reviews, this is what I use: itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=XXXXXXX
and for updating to the latest version of our app: itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftwareUpdate?id=XXXXXXX&mt=8

Resources