I am using Gmail Share Extension from Google. I am providing implementation of:
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType;
- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController;
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType;
For Mail client (from Apple) it goes into delegate method below but Gmail
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType;
Instead it shows subject same as body text. I am wondering how can I set subject different than body text for Gmail Share option.
The solutions is pretty simple - need pass NSUrl to the list of activity items.
Here is a sample on Swift:
ActivityViewController(activityItems: [URL(string: "https://www.apple.com")!])
Here is for Xamarin:
public override NSObject GetItemForActivity(UIActivityViewController activityViewController, NSString activityType)
{
NSObject item = null;
if (activityType == UIActivityType.Mail)
{
item = PlaceholderItem;
}
else if (activityType == new NSString(_gmailActivityId))
{
item = NSUrl.FromString("https://www.apple.com");
}
else if (activityType == new NSString(_sparkActivityId))
{
item = PlaceholderItem;
}
return item ?? base.GetItemForActivity(activityViewController, activityType);
}
From that perspective, if you will pass any string items - they will be copied. App Store, Facebook and others are passing URLs or URLs+Images - which looks like also are handling somehow by Gmail client.
This is a GMail app issue
A bug report was filled on 12/06/2017
https://productforums.google.com/forum/#!topic/gmail/UJJx4BcRJiU;context-place=forum/gmail
Another discussion about the issue:
https://github.com/BranchMetrics/ios-branch-deep-linking/issues/789
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With