Is some method called in the host app when today extension starts? - ios

I'm wondering if some method called in the host app when user opens app's today extension?
I use Flurry analytics framework to get statistics about my app usage and it's very important for me. But since I've added an app extension in the last update, the most users use my app only through extension. So now my statistics is horribly wrong because it shows only users that open host app.
I asked from Flurry support can I run analytics code in today extension and they answered no. So I want to start analytics code in my host app when today extension starts. Is this possible?

No, Your today extension is a separate app and not part of your main app. You could write some analytics to a shared resource and push it Flurry when the user decides to open de main app.

Related

Launch an app from within another without scheme(iOS)

Is it possible to launch another iPhone application or appstore from within another app?, For example in my application if I want the user to open another of my application from current app. (close/minimize the current app, open the Phone app). We searched and found its possible with SharedApplication. But it requires to update all our apps. We posted without customUrl or schemes. We are using Objective-C.

How to transfer a firebase dynamic link to a newly installed application?

Everything I say pertains to ios 9 and above.
Firebase documentation says:
When a user opens one of your Dynamic Links, if your app isn't yet
installed, the user is sent to the Play Store or App Store to install
your app (unless you specify otherwise), and your app opens. You can
then retrieve the link that was passed to your app and handle the link
as appropriate for your app.
I succeeded to install my application by FB-link and to open my installed application by the link. But when I try install and open in single step the application is opened without link passed. That is if my application already installed and I click on the link then the application is opened with link passed. But if application is not installed and I click on FN-link then iOS open AppStore and install the application and then I click on 'open' button and the application is opened without links. I am sorry for my bad English but hope that you are understanding me.
UPDATE
I've seen same similar question and question.
Check points.
Application starts (openURL is executed) by custom schema url (in my case it is same as bundle id)
Application starts (continueUserActivity is executed) by dynamic link.
I tryed to use cellular instead of wi-fi without success.
If application not installed taping on dynamic link open AppStore with my app.
In didFinishLaunchingWithOptions I call [FIRApp configure].
Nothing helped.
I didn't say that I use Xamarin and Xamarin FireBase
May be it uses the old version of native FireBase library.
SOLVED!
Xamarin Firebase plugin has been updated and problem have been solved.
Let me suggest how to test the Firebase Dynamic Links on iOS in the case when the iOS App is not installed.
Remove the iOS App from iPhone (ensure to use actual device, not Simulator);
Generate Firebase Dynamic Link and paste the link to the iOS Notes App;
Tap on the link in Notes App;
Ensure that you see Interstitial page, where you tap on "Open" button. After this you should be navigated to Apple AppStore;
Put breakpoint or NSLog to [UIApplicationDelegate application:openURL:options:] and observe the url value;
Install and launch the App using Xcode;
Shortly after App is launched you should observe call to the [UIApplicationDelegate application:openURL:options:] with url. Here you will call:
FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks]
dynamicLinkFromCustomSchemeURL:url];
If Firebase Dynamic Link is found you should see dynamicLink.url property being non-nil. If Firebase Dynamic Link not found, you will see dynamicLink.url property being nil.
When this scenario working well, you can re-check FDL behavior in Safari, Facebook, Email and other apps.
If App is already installed, then tapping on Firebase Dynamic Link should launch the App with the link. Watch out for [UIApplicationDelegate application:continueUserActivity:restorationHandler:], value userActivity.webpageURL.
I was able to solve this issue on my end without any code changes, and by simply running pod update and updating to the latest version of Firebase.

iOS Couchbase: Shared CBL manager between app and app extension

I'm trying to implement a shared couchbase database between an iOS application and app extension, but there is an issue with consistency between the two targets.
When the application manager deletes the database document in couchbase lite iOS, the app extension manager gets outdated.
Does anyone know how to inform the extension manager about this deletion?
The database is saved in a shared App group.
I've tried to make a pull replication for the database in my extension, which doesn't work as expected.
If I create a new manager every time I read from the database from my extension, it works as expected, but this will create a new thread for every read.
Thank you!
This blog and associated sample app illustrates sharing of data between iOS app and a Today app extension.
There appears to be an issue with replication from within iOS App extensions which is tracked here.

Retrieving a deep link when the app isn't installed (iOS)

In the iOS docs for Google App Invites, under Receiving Invitations, it is suggested that a deep link can be retrieved on first launch if the app wasn't installed in advance:
If the user has not yet installed the app, the user can choose to
install the app from the iTunes App Store. When the app opens for the
first time, the App Invites SDK will supply a deeplink if one is
available.
I've looked through the reference docs for GINInvite and GINReceivedInvite but I don't see any way to instantiate GINReceivedInvite outside of an application openURL call. Anybody know how to actually have the SDK retrieve the deep link in this scenario?
What you are trying I will say is not the correct way. You have to check in Safari web browser if app is install or not. If not navigate to App store
You can find your solution in here How to check if an app is installed from a web-page on an iPhone?

HealthKit & Today Extensions/Widgets

Has anyone combined these two new features in iOS8 yet? I'm attempting to access HealthKit from a widget. But since the application and extension use two separate App IDs - the widget automatically rejects access to HealthKit. The Notification Center/Today view doesn't display any prompt to allow access. I notice it attempts to because I see an "unbalanced view controller transition" warning in the console, but nothing is displayed.
For a manual fix - the Health app will display the bundle ID with permissions that can be manually changed. However, there's no app icon and the extension is listed as its bundle ID and not listed as its product name. This makes me think this is still something they are working on in the beta.
You could try to access the HealthKit data from your containing app and then share those data with your extension through App Group.
I haven't looked at HealthKit yet, but in another case the App Group feature worked fine for me.
I haven't tried doing this type of combination between those features in my app yet, but while integrating the HealthKit capabilities, I happened to see the following in HealthKit documentations:
Both HealthKit and the Health app are unavailable on iPad. The HealthKit framework cannot be used in an app extension
So I assume a direct way is not available... You can read more here: HealthKit_Framework Documentation
You won't be able to access HealthKit. To quote Apple's App Extension Programming Guide:
Some APIs Are Unavailable to App Extensions
Because of its focused role in the system, an app extension is ineligible to participate in certain activities. An app extension cannot: …
Use any API marked in header files with the NS_EXTENSION_UNAVAILABLE macro, or similar unavailability macro, or any API in an unavailable framework
For example, in iOS 8.0, the HealthKit framework and EventKit UI framework are unavailable to app extensions.
[emphasis added.]

Resources