How to open Dropbox app from an another App in IOS Xamarin? - xamarin

I am trying to open the dropbox App from my app. Here I can link and upload the files into the dropbox correctly. I have a link button to dropbox in my app, on clicking this I can be redirected to the dropbox app, I am using the code below.
if (!UIApplication.SharedApplication.OpenUrl(NSUrl.FromString("testscheme://com.account.appname")))
{
NSString urlString = new NSString(Session.DropboxAPIHost);
NSUrl myFileUrl = new NSUrl(urlString);
UIApplication.SharedApplication.OpenUrl(myFileUrl)
}
But nothing will happening. I am new to xamarin Please suggest a solution

I think you can use url scheme to open dropbox.
I tried it and it works ~
//dbapi-1 is Dropbox url scheme
NSUrl appurl = NSUrl.FromString("dbapi-1:");
UIApplication.SharedApplication.OpenUrl(appurl);
And maybe you can see this
Does dropbox app on iOS has a URL scheme?

Related

Where to put Sqlite database on iPad

I'm writing an app for Apple's iPadOS that uses an SQLite database. I'm controlling the DB using FMDB. During my development I'm pointing FMDB to my local Mac development folder so that I can interrogate the DB using SQLiteStudio instead of digging it out of the development folders that Apple XCode defaults to. When I deploy the application I'd like to be able to put it on the iPad where the Apple "Files" app can see it. I'd like to be able to back it up using iTunes like I can the database of another app that I've purchased.
My question is how to configure the database location on the iPad to be able to achieve those goals. Right now in XCode development I point to:
let databaseFolder =
"/Users/robertpetruzzelli/Desktop/MyProjects/ManagingYourMoney"
and when I test on the iPad I change the file path to:
let databaseFolder = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as NSString) as String
which works for the app to see the DB on the iPad, but it isn't visible in the Files app...
Any assistance would be greatly appreciated.
Bob
Well in a round about way I solved my quandry. Using
let databaseFolder = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as NSString) as String
is the right thing to do, but I needed to do the steps in the link below:
Deploying SQLite DB to iPad app (via iTunes?)
By doing this I could see my app on my iPad in finder and see the file there. I could copy the file to my Macbook Air and work on anything I wanted to investigate there.

Xamarin.Forms iOS image cannot show from file path

In my Xamarin.Forms app, I have copied some files into my device and those files don't have an extension. Actually those are image files. now I want to show those images in my UI. For that I am doing like this in my shared project.
string path = DependencyService.Get<IFileManager>().GetLocalFilePath(attachmentName);
image.Source = ImageSource.FromFile(path);
Both in UWP and Android these images are showing perfectly but in iOS. This is the path that I am getting for iOS.
"/var/mobile/Containers/Data/Application/74FC64B4-3B37-4240-966B-2DB1CAFF0E45/Documents/Library/Databases/5302"
5302 is my file name and it has no extension. In iOS I cannot see any image. Please help me.
Thanks.
Put all your images in the Resources-folder of your iOS-project and it should work!

Download Zip file through SFSafariViewController or Webview in Xamarin iOS

I am loading SFSafariViewController in my Xamarin iOS and loading https://osdn.net/projects/sfnet_fotohound/downloads/sample-pictures/Sample/Sample-Pictures.zip/ this URL.
When I hit this URL in my Safari App, a Zip file is automatically downloaded and a Open In.. option comes.
BUT nothing happens when i load this url in my App in SFSafariViewController or Webview

NSWorkspace openURL not opening files stored in iCloud Drive with default app for file type

In my app I use the following code to tell Mac OS X to open a file at a specified URL:
[[NSWorkspace sharedWorkspace] openURL:fileURL];
Where fileURL is a URL to a file stored in my app's iCloud Drive container folder.
In El Capitan, it seems that when a file is placed inside an app's iCloud Drive container, the owner of that file changes to the app who owns that iCloud Drive container.
In my situation, it means that my own app is being asked to open up any file type for files that are stored in my app's iCloud Drive container. If you take the same file and move it to your desktop, the original default app correctly launches.
Has anyone else seen this new behaviour of El Capitan?
I have filed a radar for it: rdar://22213595
Hopefully someone has found a workaround for this. It presents a problem for any app which uses NSWorkspace's openURL command if the file is stored in iCloud Drive. Just because I link to a file from my app, doesn't mean that my app should be responsible for opening it. iTunes should open music files, Preview should open PDFs and Excel should open .xlsx files for example, unless the user has specified otherwise of course.
It shouldn't matter where on someone's drive the file resides to determine which app to use to open it with.
This is the current status from Apple:
"Our iCloud team mentioned that it was an intentional change in El Capitan, but I am still checking with them the logics on the back and if there is anyway to change that behaivor. I’d update to you once getting their response."

Change OSX Notification Center icon at runtime

Is there (now) a officially supported way to change the OSX Notification Center's Icon for NSUserNotifications while my App is running?
I searched the web, but the answers weren't really "recent", so I just wanted to double check.
I'd like to show the currently playing spotify track's Artwork next to it's title / name
What I tried until now is really ugly:
temporarily replacing the CFBundleIconFile of my app with a IconFamily generated .icns file (I know i shouldn't modify anthing inside the bundle, but I'm not aiming to get the app to the App Store)
restart Notification Center to "forget" it's eventually cached icons
NSRunningApplication* notificationCenter = [NSRunningApplication runningApplicationsWithBundleIdentifier:#"com.apple.notificationcenterui"];
[notificationCenter terminate];
(i know I REALLY SHOULDN'T do this)
If you are NOT going to submit your app to App Store, there's a private API in 10.9 that does what iTunes did:
NSUserNotification *notification = [NSUserNotification new];
[notification setValue:anImage forKey:#"_identityImage"];

Resources