Xamarin Essentials Share does not have load option - xamarin

My app backs up its data in a zip file that uses Share.RequestAsync to store the file. This works great because it presents all the possible sharing options including email, messaging, and cloud devices like Google Drive, Dropbox, etc.
In order to load that zip file from wherever it was stored I use FilePicker.PickAsync. The problem is that this presents a very limited number of options for selecting the file. It offers either the local device or a single cloud service (iCloud on iOS or Drive on Android). What if I want to restore the zip file from Drive in my app on my iPhone?
Why is there such a difference in the xamarin share options when it comes to saving and loading files? It seems like the Share class should offer a method to load files that presents the same options that it does for sharing. Or at least the FilePicker.PickAsync should present the same interface as Share.RequestAsync for load options. Am I missing something?
Here is what the share dialog looks like compared to the file picker on iOS. It is similar on Android. The share offers access to iCloud, Drive and Dropbox while the picker only offers access to iCloud.

Related

How to restrict the apps in the share dialog in Xamarin Forms?

I can share some text or files with external apps with Xamarin.Essentials: Share Feature.
Well, can I restrict the apps shown in the popup to share? For example, can I set it to show gmail but not whatsapp in the popup?
I need this for both ios and android in the Xamarin.Forms app. How to handle it?
Thanks.
The Xamarin.Essentials: Share Feature only provide the the method to share the file or text for other applications. The system will detect the file type (MIME) and request a share. Each platform may only support specific file extensions.
Here is the Share Class API, you can refer to this.

codenameone downloading files/images visible to other apps

I note that other apps (testing on Android) like WhatsApp, etc have folders that contains images the user has used/downloaded. These folders (like WhatsAppImages) are visible in other apps (Gallery/File Explorers, etc) so you can use those files to share, delete, etc like any other file.
In my codenameone app I download image files but they cannot be seen anywhere on the local device. I understand that for security apps run in a sandbox and this may be why.
But how do these other apps make their downloaded files visible to the general file system and other apps ?
Many Thx
Codename One doesn't support that at this time but you can use native interfaces to add this as explained here for Android: How to save image in android gallery
and here for iOS: How can I save an image to the camera roll?
You can also file an RFE to add this either as a cn1lib or API.

How to: upload user files to iCloud + retrieve files from iCloud? (Nativescript)

In my iOS nativescript app, I want users to be able to upload files to iCloud and also retrieve them from iCloud. So it would work like other apps, such as photos, where you can save your photos and retrieve them from iCloud.
The goal is to remove stress on phone storage.
Is this possible?
I earlier asked a question regarding backing up all app data to iCloud (link). It looks like this is possible--users can add the app to an iCloud backup. But this is different than what I am asking here. In that case, a user would have to retrieve all of their phone's data from the backup.
Here, I am looking for a way for users to (1) upload just specific types of files (say, pdf files or media files) to iCloud that they could later (2) download into the app itself.
In other words, they could choose to save and access files using iCloud instead of storing them locally on their phones.
I have seen this question asked earlier on nativescript forums and stackoverflow, but without answers.
So any help is appreciated.

Can a Xamarin app be updated by downloading an image, CSS, or .js files using WCF service?

Suppose we write a Xamarin MVC application which is deployed to a device and runs connected to the web.
If we need to update the application by downloading some images, CSS, or .js files using WCF service, for example, is that possible?
Does iOS, Android, and Windows allow you to do that?
Thanks
You can not update the app bundle itself on either iOS or Android, and presumably UWP but I am not very familiar with that platform so not sure. For iOS and Android the app bundles are signed so they can not be modified or else the signature will no longer be valid. You can, however, download anything you want and store the downloaded files in the file system. Every app does have a file system it can access to read and write from. See this Xamarin doc:
Forms:
https://developer.xamarin.com/guides/xamarin-forms/working-with/files/
You might also want to look into the PCLStorage plugin:
Xamarin Component: https://components.xamarin.com/view/pclstorage
NuGet: https://www.nuget.org/packages/PCLStorage/
Source: https://github.com/dsplaisted/PCLStorage
(I know I should paste relevant bits from links, but there is just too much to paste and would end up pasting the whole article. If above link is broken, just google "Xamarin working with files")
Note: I work for MS/Xamarin

Sharing Files with other Chrome Extensions using ARC

We have an Android application that we have developed and are testing with ARC. Part of the functionality is to share Word/PDF and other documents with other applications on an Android device and then have them pass the content back to us when done. However, since ARC applications run in their own sandbox instance of Android there are no other applications to share with using the standard intents. I know that Chrome Extensions can message each other, but is there a way to access this functionality from an Android APP running arc. Ideally we'd like to share a document have it open in say Google Drive, and then be able to get it back from there using the standard Android intents. Is this possible, or do we have to look at other ways to accomplish this (i.e. SDKs.)
Update: Here is the code we use to launch external activities to have them open files for editing:
Uri uri = Uri.fromFile(attachmentFile);
Intent intentUrl = new Intent(Intent.ACTION_VIEW);
intentUrl.setDataAndType(uri, applicationType);
intentUrl.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getContext().startActivity(externalActivityIntent);
You can get the file from Google Drive or any other file provider available on the chromeOS using the new intent: ACTION_OPEN_DOCUMENT

Resources