How can I share a audio file from my app to other apps and receive audio files from other apps?
I would like a functionality like this:
I am unable to attach a audio file. Here is the code snippet:
var fileData = NSUrl.FromFilename(path);
var item = UIActivity.FromObject(@"<html><body><b>URL</b>: <a href='" + url + "'>" + url + "</a></body></html>");// NSObject.FromObject(uiImage);
var activityItems = new[] { fileData };
NSString message = (NSString)"Test";
var activityController = new UIActivityViewController(activityItems, null);
activityController.SetValueForKey(NSObject.FromObject("The subject value"), new NSString("subject"));
var topController = UIApplication.SharedApplication.KeyWindow.RootViewController;
while (topController.PresentedViewController != null)
{
topController = topController.PresentedViewController;
}
topController.PresentViewController(activityController, true, () => { });
I would also like to add subject and body if file attached as mail.
tried this but no luck, getting an error.:
activityController.SetValueForKey(NSObject.FromObject("The subject value"), new NSString("subject"));
activityController.SetValueForKey(NSObject.FromObject("The body value"), new NSString("body"));
Also I would like to receive audio files shared by other apps. I have done the feature in android using dependency services and intent filters. For android the code is been added to mainactivity.cs where I use intent filters to accept audio files from other app. How to do that in iOS?