Confused about Web share API and Cordova share plugin - javascript

I'm trying to implement a share feature in my Cordova app to let users share their pictures
According to the Chrome dev team they introduced a Web share API directly into Google Chrome. To share something just call:
navigator.share({title: 'Example Page', url: 'https://example.com'});
but as far as I know Cordova also has a plugin, namely cordova-share-plugin
To use this plugin, simply call:
navigator.share(text,title,mimetype)
This is where I get confused. Both the built-in share API and the Cordova plugin have the same method navigator.share(). The expected parameters are different.
If I have installed the cordova share plugin and I call navigator.share() which code get executed? the plugin or the native share API?
It looks like one of my user is unable to share pictures because the call to navigator.share() fails silently. He has Android 8.1.0. All the other users seem to trigger the Cordova plugin when my app calls navigator.share()

That's a pretty old plugin, created when navigator.share was not available in the browser.
The plugin clobbers navigator.share, so it will use the plugin implementation instead of the browser implementation.

Related

How to use OAuth with Facebook in a Safari App Extension

My question is similar to How to use OAuth with Github in a Safari extension, however, the answer there explains how to use oauth with the older safari extension API. I am trying to use OAuth with the new Safari App Extension API (https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/SafariAppExtension_PG/).
The new API allows the writing of native code, in addition to providing the ability to inject content scripts. Where should I perform the authentication? I also developed a chrome extension, and Google provides an API for retrieving OAuth tokens (https://developer.chrome.com/apps/identity) -- however I do not see anything similar for Safari App Extensions.
Any help is greatly appreciated!
I am currently working on Safari App Extension similar to your needs and the logic, certs (if you use them) persistence, access and refresh tokens all of them goes to the native code. From the SFSafariExtensionHandler you can control the active window/tab and all the pages in the tab, also receive callbacks from the pages.
For the OAuth use any native lib. that solves most of your needs for the logic. I am using this one from AeroGear.
Some adaptation will be needed for the page controlling.

<a href="fb//"> open post/video Link in native App? [duplicate]

Some dev blogs have published information about the "fb://" url scheme for opening various views in the Facebook iPhone App. No matter how much I've searched, I haven't found one word from any official Facebook source about this.
Since the information is public anyways, I'm sure I'm not the only one who'd like to know, whether using this url scheme is officially approved, am I allowed to use it, does it work correctly, and if it's not approved, will it be and what's the approximate schedule for that?
Thanks in advance for any info on this subject!
It's there to support the iOS push notification system (i.e. you get a push notification that says "Friend's Name tagged you in a photo", and you tap on it, it takes you straight to the photo).
I'd assume it's not intended for third party use and therefore subject to change. Hell, Facebook's public-facing APIs are subject to change on a whim anyhow, so I'd be especially cautious about something they hadn't documented.
It's for iOS only. The iOS API lets you define you own URL scheme, so Facebook must have developed their application to register the fb:// URL scheme on iOS devices. It's not a feature that was created by Apple, it's something you, the developer, can make up.
Here are some resources you can investigate
The Facebook iOS SDK
Here on StackOverflow
A tutorial on how it works (not Facebook-specific)
You can use it from your own applications on iOS, but only if the Facebook application is installed. There are, however, plugins and browser extensions out there that mimic the behavior by handling the fb:// schema on your desktop browser.

Using Paypal Cordova Plugin, cannot get it to work using production or sandbox mode

I am getting this error when I switch to sandbox mode using the cordova paypal plugin, located here https://github.com/paypal/PayPal-Cordova-Plugin
When I run this plugin using the PayPalEnvironmentNoNetwork mode, everything works perfectly as I intended. I set up a classic payapl api app and put in the correct production id and sandbox id, but it does not seem to want to work with those is there something I am missing?
I have never used PayPal's api before so I am not quite sure what I am doing, just trying to set up a simple donation flow in my app.
You need to create a rest paypal api app, not classic since the cordova sdk is built on top of the mobile sdks which calls the rest apis. This should be helpful to get started https://developer.paypal.com/docs/integration/direct/make-your-first-call/

Google Analytics not working in Webview in iOS app

Let me first start out by saying I know how to use the iOS SDK so please don't answer this with a "just use the SDK." I want to know WHY google analytics is not working.
Here's my setup. I have a web app that is also baked into an android app and ios app via webview. I'm using cordova. The android app works just fine with the GA JS code. The web works just fine. However no events or page views are showing up from iOS. I've heard that GA is tied to the domain so does an iOS Webview do something under the hood to the domain?
I was going to attach my code snippet but it's coffeescript in a few classes so I'll just paste the compiled js
Analytics.prototype.track = function(args) {
window._gaq.push(args);
};
Analytics.track(['_trackEvent', 'SubscriptionModal', "Closed", data]);
This works fine in web and android so it's not a JS. I'm setting the GA _setDomainName to 'focusatwill.com' and can see that both ios and web have a domain of 'www.focusatwill.com'
I've read online a few people talking about this issue and everyone says just use the SDK. I'm looking for the reason why it doesn't work. How do you fix it to use the JS?
edit
I should mention that the html and JS are not baked into the device, ie they don't have a local url but are served up from our webserver
Safari on iOS6+ blocks third party cookies by default, and I'm certain that webviews do too.
Check that you have something similar to the following in the init method of AppDelegate.m:
NSHTTPCookieStorage* cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
[cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
That's from the standard boilerplate generated by Cordova 3.0.9, but might not be present if you're using a version that predates iOS6. It sets the app-specific cookie policy, which should override the system default.

trigger.io — Google Analytics

How does one go about including Google analytics for Trigger.io-built apps? I can see that the mobile web built with trigger.io would be just a matter of embedding the GA JS code. But what about iOS or Android?
We have integrated the Flurry Analytics SDK as of our v1.4.19 platform release. Documentation available here:
http://docs.trigger.io/en/v1.4/modules/flurry.html
It is also possible to integrate the Google Analytics native SDK (or any other analytics SDK) using the plugin system.
Simple answer:
You already answered your own question - embed the Google GA JS code.
Alternative answer:
Another alternative is that you could utilize forge.ajax and fire the .trackPageView method in the success callback. In this case you would have to add the proper domain permission in your config file.
However, isn't GA tied to a specific domain (or group of domains)? In the case of PhoneGap or trigger.io there is no domain name.
Also, see this question & answer -
Step by step to get Google Analytics working in PhoneGap 1.2.0 on iOS (phonegapalytics)
Embedding the JavaScript version of Google Analytics won't work - for some reason, the tracking calls don't fire any events, so you need to use the measurement API.
I've created a plugin that allows you to use Google Analytics with Trigger.io on github, which you can use: http://bit.ly/1F3VM1J
The plugin uses the Request and Prefs module to send analytics data to Google, and it works with the realtime dashboard too. You can track screenviews and events only at the moment, but it should be sufficient for your application.
To track a pageview, you can do the following:
// send screenview tracking data
ga('send', 'screenview', 'App Load');

Categories

Resources