Xamarin-iOS: host application will not run with share extension - xamarin

My app setup is a basic new app with default viewController with the default classes for share extension on iOS 11.2.
The host AppDelegate class FinishedLaunching never gets called.
Just shows the launch screen and closes the app.
The sample Xamarin app provided also has the same issue.
Link to the sample app:
Share Extension sample
Any idea whats going wrong?

Do you want to open the app which you created with the share extension, when user clicks the share button to use this share extension? If so, this app should be called Containing App.
But unfortunately, there's no way to do this on iOS8.3+ except Today Extension. From this post we know that:
The intended approach for share extensions is that they handle all of
the necessary work themselves.
Also from the Apple documentation about extension:
An extension’s UI should be simple, restrained, and focused on
facilitating a single task.
Apple doesn't recommend us to open its containing app from extensions, actually it avoids that. If you want to retrieve data in containing app, you can set up an app group so that data can be shared between these two apps.

Related

How can Xamarin be used to wrap a web app as if it were a native app for Android?

Say I build a super mobile friendly web application that I want in the Play Store for Android users to be able to download.
Could I use Xamarin to:
Wrap the entire mobile app as a single WebView
Register for mobile push notifications
Essentially shortlining an MVP of an android app by using an existing web app? If so, is there any well-known process or documentation that demonstrates this?
Probably the best approach for you would be using Xamarin Forms with one or more pages containing only web views.
I don't love Xamarin Forms because usually for me Xamarin Android+iOS gives a better result in similar time, but your app would be so simple that doesn't make sense to do it with Xamarin Android.
Make sure that your web app will show only what makes sense to be shown in your app, otherwise you risk to see double header/footer, useless buttons... but if the website is yours adding a few parameters to change a bit the UI won't be a problem I guess.
Have a look at this example:
https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithWebview
Another approach is the use of Razor to build your pages in html directly inside your app, but if I understood well it's not what you need:
https://developer.xamarin.com/guides/cross-platform/advanced/razor_html_templates/
Although it is technically possible to do this as the previous answer has suggested. I would recommended firstly reviewing, the relevant stores guidelines on submissions. Apple for example will not allow a submission to their store of any application that simply mirrors the functionality of a website. I suspect Google's would likely be the same.
However that said, to answer your question, Xamarin.Forms would be appropriate for a simple application like the one you are suggesting. Or if you prefer to build to a specific OS, then in iOS with Xamarin you would use the Safari View Controller that was added in it's xcode 8.1 release. Android uses something similar as does windows.
EDIT:
You can use the Web View control in Xamarins Andorid native PCL project to encapsulate your mobile friendly website within an application here is the documentation:
Xamarin Android Developer link to Android Web View
As for push notifications, yes this is perfectly possible using Xamarin.Android. and varies on implementation depending on what you want to use as the back end to handle them, I.E. Azure's notification hub etc.

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

Is it possible to create an iOS 8 sharing extension that opens the website in its app?

I'm building an app, and I was curious if there's a way to open the app when you're on the website through the iOS Safari extension. So, if I'm on a post I'd tap the app icon in the share sheet and I'd pass that to the app to load the post in the app.
I know the Bing app can translate the current website and inject directly into the DOM, so I was wondering what custom logic you can implement.
There's really no way to open the app from this kind of extension. Extensions can't access [UIApplication sharedApplication], so they can't call openURL:. There's an openURL:completionHandler: method on NSExtensionContext, but it only works in "today" extensions. Share extensions can display a fully custom UI and can save data that's available to their containing app, but they can't actually open that app.

How to stop presenting share extension in "Open-In" options Menu View?

I am developing share extension for my app. In my share extension info.plist , i added NSExtensionActivationSupportsImageWithMaxCount activation rule.So i expected my app share extension will present in any image share from any apps.But my issue is my app share extension also presenting in apple's Open-In options menu view.Is there any way to stop presenting my app in Open-In menu?
Note: My app has supports Custom URI schemes for different type documents.

How to track events in extension?

Most iOS analytics tools (flurry, new relics) use the standard uiapplication delegate methods to upload events in batch, every minute or when the application terminate. I haven't seen any dedicated solution for extension (today, photo...) from these guys. What do you do for analytics in extension in ios8?
For now, I used two work arounds
1 - I used app group shared data https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html and I log the event when the user open the containing app
2 - My today extension allow user to openURL to open the containing app, I pass data in the params of the url.
In my WatchKit app, I use openParentApplication:reply: to pass a request to the host app and log my analytics from there.
Flurry has announced support for Apple Watch extensions. You can find out more in the developer documentation here:
https://developer.yahoo.com/flurry/docs/analytics/gettingstarted/technicalquickstart/applewatch/
It's possible that this will open the door for tracking activity within other extensions, but I haven't seen anything about it yet.

Resources