Git Product home page Git Product logo

appavailability's People

Contributors

damian-r-smith avatar ohh2ahh avatar pke avatar ronaldozanoni avatar xizhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

appavailability's Issues

checkAvailability crashes with empty scheme

line 12 in AppAvailability.m crashes if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]) with 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance.
Instead it should set the pluginResult to false if there is no scheme specified.
I remember the app working before, and since this plugin has not changed, I suspect now that the iOS implementation for canOpenURL might have changed an no longer accepting NSNull.

We ran into this situation since we just forward an API sent scheme to the function and the server sent no value down (or an empty string).

Can't this plugin create the whitelist for us?

Doesn't cordova plugins support a mechanism to have config.xml variables iterated and inserted into the plist like this?

<platform name="ios">
    <config-file target="*-Info.plist" parent="LSApplicationQueriesSchemes">
      <array>
        <string>$SCHEME</string>
      </array>
    </config-file>
  </platform>

But I am not sure if plugins can do that?

app available but not opening

How can an app be opened? I have some apps that provide deeplink parameters, so I am passing those parameters into "deeplink" below....but other apps don't have deeplinks (that I am aware of), so how can I just get the app to launch?

On Android, I have the package name (not certain how to get it for iOS), and as best I can tell appAvailability.check is seeing the app installed, but its not able to open it.

two examples:
// works
var scheme = "com.ubercab" ;
var deeplink = "uber://" ;   // documented uber deeplink, uber app launches just fine
// does not work
var scheme = "com.tride.passenger" ; 
var deeplink = "tride://" ;  // not deeplink documented, "tride://" I made up, Tride app does not launch, but it is installed (and "alert" appears)...so what else can I define "deeplink" as to get the app to open?
  appAvailability.check(
    scheme,
    function() {
      // app is available
      var newWin = window.open(deepLink,'_system','location=no') ;
      errMgmt("index/externalApp",1021,"Deeplink: "+deepLink) ;
      if (newWin || newWin.closed) {
        alert(vendorID+ "does not have ability to be auto-opened, you will need to manually open the " +vendorID+ " app.") ;
        errMgmt("index/externalApp",1022,"Deeplink to "+vendorID+ " failed to open") ;
      }
    }, function () {
      // app is not available, open website link
      window.open(url,'_system','location=no') ;
      errMgmt("index/externalApp",1023,"Url: "+url) ;
    }
  );

Not working on iOS (phonegap build cli-6.5.0)

Hello i try that on ios and android.

On android its working

	$.each( app_list, function( i, scheme ) {
		appAvailability.check(
			scheme, 
			function() { 
				console.log( scheme + ' is available');
			}, 
			function() { 
				console.log( scheme + ' is not available');
			}
		);

but on ios (10) only false back -> not working came back
twitter
twitter:
twitter://

But i can open the apps with onClick="window.open('twitter://*'', '_system');

install command does not work for cordova 7.0.1

cordova plugin add cordova-plugin-appavailability --save and cordova plugin add https://github.com/ohh2ahh/AppAvailability.git fail with the same error message

Error: Failed to fetch plugin git+https://github.com/ohh2ahh/AppAvailability.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Failed to get absolute path to installed module

v0.3.0 is not supported in PGB 3.0?

The version 0.3.0 of the plugin is not supported in Phonegap Build 3.0 yet? Because I tried to use it, but say that this version is not supported.

The v0.3.0 appears like the newest version, but is not supported by PGB 3.0, and in the PGB Plugins page (https://build.phonegap.com/plugins/712) is not the 0.3.0 version.

Is not supported yet or is another problem? Thanks!

Unsupported class version number [52] (maximum 51.0, Java 1.7)

Android
Apache Cordova 4.2
Android Studio 1.1.0
Java 1.8

Error:ProGuard: [PMRadio] Caused by: java.io.IOException: Can't process class [com/ohh2ahh/appavailability/AppAvailability.class](Unsupported class version number [52.0] %28maximum 51.0, Java 1.7%29)

Does this work with IOS 8?

Hi,

I've installed the plugin via Phonegap build using the following:

<gap:plugin name="com.ohh2ahh.plugins.appavailability" version="0.3.1" />

I'm getting no errors and I can see the JS file when debugging.

I'm using this code:

    var fbCheck = "";
    var twitterCheck = "";

    if (window.device.platform == "ios") {
        fbCheck = 'fb://';
        twitterCheck = "twitter://";
    } else {
        fbCheck = 'com.facebook.katana';
        twitterCheck = "com.twitter.android";
    }
    appAvailability.checkBool(fbCheck, function (availability) {
        // availability is either true or false
        self.hasFacebookNativeApp(availability);
        alert("Has Facebook Native App " + availability);
    });
    appAvailability.checkBool(twitterCheck, function (availability) {
        // availability is either true or false
        self.hasTwitterNativeApp(availability);
        alert("Has Twitter Native App " + availability);
    });

When I run this on an iPhone 6 with IOS 8 and Facebook & Twitter Native apps installed the availability is false. I also tried using the new method with callbacks and it was the same.

I have confirmed that I can open a profile with fb://profile so it should work.

Am I missing something here or does the plugin not work with IOS 8?

Couldn't that plugin modify the plist on iOS upon install from config.xml variables?

Modifying build artefacts like anything inside platform is always a bad idea.
Isn't there a way this plugin adds the required protocols to the plist itself based on variables defined in config.xml in this plugins config section?

<plugin name="AppAvailability" spec="lates">
        <param name="protocols" value="1password  ophttp" />
</plugin>    

iOS 9 and iOS 10: -canOpenURL: failed for URL

AppAvailability Bug
appAvailability.check returns alway error callback.

Xcode error
-canOpenURL: failed for URL: "<scheme>://" - error: "This app is not allowed to query for scheme <scheme>"

Explanation
Apple changed the canOpenURL method on iOS 9. Apps which are checking for URL Schemes on iOS 9 and iOS 10 have to declare these Schemes as it is submitted to Apple. The article Quick Take on iOS 9 URL Scheme Changes expains the changes in detail.

Solution: Add URL Schemes to the Whitelist
Simply open your app's .plist (usually platforms/ios/<appname>/<appname>-Info.plist) with an editor and add the following code with your needed Schemes.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>twitter</string>
    <string>whatsapp</string>
</array>

Return value is always No

Welp inexperience is shown, you must test this functionality through xCode simulator or an actual phone plugged in, this wont work with Ionic Serve

Launch if it is available

Would be nice if this plugin could launch the app or go to Play Store/App Store. So we could do this

appAvailability.check(
    'twitter://', // URI Scheme
    function() {  // Success callback
        console.log('Twitter is available');
        appAvailability.launch("twitter://");
    },
    function() {  // Error callback
        appAvailability.goPlayStore("twitter://")
    }
);

Publish the plugin on the Apache Cordova Registry

Hi, it seems the plugin is published on the Adobe Phonegap Build Registry but is not published on the Apache Cordova Registry.

So we can build our project on Phonegap Build but not directly using the Apache Cordova CLI tools.

See also the following links :

Thanks.

Change .Info.plist to config.xml

Can you add a section in config.xml that specifies what links I want to query for and then put those in my Info.plist automatically? Editing the plist on every one of my developer's machines is not ideal.

Support scheme query on Android too

I'd like to add support to query the system for apps that handle a specific scheme for Android just like its possible on iOS.
This can also be done via Package Manager and an Intent query.

const PackageManager manager = context.getPackageManager();
const bool appAvailable = manager.queryIntentActivities(intent, 0).size() > 0;

Would u accept a PR?

White screen in IOS application.

When I tried to open other ionic application using this cordova plugin, if IOS open is already in background, application is not getting load as expected. It shows errors like fonts, images are not loading eventually which shows white screen.

Move this plugin to the cordova.plugins namespace

Thanks for this plugin!
However this plugin pollutes the global namespace. Imho it should install itself into cordova.plugins or just set a isAppAvailable or canLaunch on cordova.
This could be done with back-compatibility and a deprecation warning to the console.
If you agree I'd create a PR.

Uncaught ReferenceError: appAvailability is not defined:

I'm trying to configure the plugin in my application but that not is working.
I do this -> cordova plugin add https://github.com/ohh2ahh/AppAvailability.git
After you says: "You don't have to reference the JavaScript in your index.html."
but my LogCat says "Uncaught ReferenceError: appAvailability is not defined:39"

config.xml
< feature name="InAppBrowser" >
< param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" / >
< /feature >
< feature name="AppAvailability" >
< param name="android-package" value="com.ohh2ahh.appavailability.AppAvailability" / >
< /feature >
< access origin="twitter://user?screen_name=lhollowmanl" / >

I'm using:

appAvailability.check(
'com.twitter.android', // URI Scheme
function() { // Success callback
console.log('Twitter is available');
},
function() { // Error callback
console.log('Twitter is not available');
}
);

Please help me :) Thanks you!

Phonegap Build Error

I have included your plugin n my config xml as instructed, and as I have gotten other plugins to work.

Running your code in the weinre console:
appAvailability.check('com.twitter.android', function(availability) {
// availability is either true or false
if(availability) { console.log('Twitter is available'); }
});

Produces this error:
ReferenceError: appAvailability is not defined

Do you have any updated instructions on how to get this working? It looks like exactly what I need to use.

iOS installing

Hi! I am trying to learn this new way of developing to phones with hybrid application and i dont know how to install this plugin in XCode 4.6.
Can you pass how i can do?

"class not found" on android

Hi,

I'm using this plugin and it work flawlessly on Ios. :)
But on Android, it don't, if I try to get an alert of the availability variable like that :

appAvailability.check('com.twitter.android', function(availability) {
alert(availability)
// availability is either true or false
if(availability) { console.log('Twitter is available'); }
});

It return "class not found"

Can you help me?

Checking if googlemaps is installed always invoke the success callback on IOS

Hi guys,
I'm trying to use your plugin to check if google maps is installed here is my code:

        $cordovaAppAvailability.check('comgooglemaps://')
          .then(function () {
            console.log("google maps is installed");
          }, function () {
            console.log("google maps is not installed");
          });

The problem is that after i removed google maps app from my device success callback is still invoked for googlemaps app. At the same time in the case of whatsapp the plugin works correct and invokes to error call back after whatsapp removal. Also if i run the app on iOS simulator where google maps is not installed the plugin also works correct and invokes error callback.
I'm using ionic framework and ng-cordova.
device: iphone 5s
iOS: 10.2.1
cordova: 6.4.0
cordova plaform ios version: 4.3.1
Xcode: 8.2.1
plugin version: 0.4.2

iOS 9.2

I am having problems to detect apps, the only one that is detected is apple maps. For example I try with twitter, google maps and waze and non of them get to the success function.The schemas that I tried are : waze:// , twitter:// and comgooglemaps://

Do you have any idea what might be the issue?

Using with PhoneGap Build

I apologize if this is the wrong place to post this issue.

I am trying to use your plugin with PhoneGap Build but I can't seem to get it to work. I have added the line below to my config.xml

<gap:plugin name="com.ohh2ahh.plugins.appavailability" />

And I am using this javascript on my page:

console.log("Test6");
window.appavailability('fb://', function(availability) {
// availability is either true or false
if(availability) { console.log('Facebook is available'); }
});
console.log("Test3");

In the debug console on PhoneGap build I see "Test6" but "Test3" never gets written. And I have Facebook installed on the iOS device I am testing on.

After that I add teh AppAvailability.js file to my project and at that point I would see "Test6" and "Test3" but still no "Facebook is available". And facebook is installed.

I'm building with PhoneGap 2.9 which looks to be supported. Thanks for your time.

How do I know in advance that I would want to query APP's keywords

in your sample
the IOS's Facebook's keywords is => fb://
the Android's Facebook's keywords is => com.facebook.katana

and...how a about twitter or whatsapp or other app that I want to search
I want to ask, is there any way to first find out in advance the right keywords
TKS~

Checking an app NOT installed always invoke the success callback on IOS

Hi guys,

Did you ever experienced something similar ? Even though the app has been removed, AppAvailability still invoke the success callback. Restarting the phone doesn't change anything.

Is there a cache of some type ? I tried to remove the scheme in Info.plist, don't change anything.

appAvailability.check(
    'http://www.bepark.eu',
    function () {  // Success callback
        // always invoked even tough the app is not installed anymore
    },
    function () {  // Error callback
        // do something
    }
);

Environment:

  • XCode 7.3.1
  • Cordova 6.3.1
  • Node 5.5.0
  • iOS 4.2.1

'facebook://profile/pagename' not working in android

your plugin works good for twitter. But for facebook, i couldn't make the plugin to open facebook app page. instead it open the facebook feeds

var x = "https://www.facebook.com/McDonalds";
var array = x.split('/'); 
var nam2 = array[array.length-1];

//If Android
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");

if(isAndroid) {         //alert(nam2);

appAvailability.check('com.facebook.katana', function(availability) {       //alert(availability);
    // availability is either true or false
    if(availability) {window.open('facebook://profile/'+nam2, '_system', 'location=no');}
    else{window.open(x, '_system', 'location=no');}
}, function(e) { window.open(x, '_system', 'location=no'); });

}

I even tried with
facebook://pages
facebook://page

but the plugin opens the facebook app instead of facebook app page.

Any workout is appreciated.

FireOS app scheme detection failed

Adobe Acrobat reader: Can't detect scheme for FireOS while native Android can. Not sure if it's affected to SS or any other devices or its variant Android powered.

Cordova 3.3 CLI

Hi, I think there is something wrong with the Cordova Plugman installation with CLI 3.3 as it doesn't include the file in cordova_plugins.js and while debugging I noticed that the file isn't included in the html.

about check autonavi

help me

***.check ('com.autonavi.minimap')
.then(()=>do something)

not work

here is dependencies

"dependencies": {
"@angular/common": "4.4.6",
"@angular/compiler": "4.4.6",
"@angular/compiler-cli": "4.4.6",
"@angular/core": "4.4.6",
"@angular/forms": "4.4.6",
"@angular/http": "4.4.6",
"@angular/platform-browser": "4.4.6",
"@angular/platform-browser-dynamic": "4.4.6",
"@ionic-native/app-availability": "^4.6.0",
"@ionic-native/app-minimize": "^4.5.3",
"@ionic-native/app-version": "^4.3.2",
"@ionic-native/background-mode": "^4.5.3",
"@ionic-native/camera": "^4.3.2",
"@ionic-native/clipboard": "^4.5.0",
"@ionic-native/core": "3.12.1",
"@ionic-native/file": "^4.3.2",
"@ionic-native/file-opener": "^4.3.2",
"@ionic-native/file-transfer": "^4.3.2",
"@ionic-native/geolocation": "^4.5.2",
"@ionic-native/image-picker": "^4.5.3",
"@ionic-native/in-app-browser": "^4.3.2",
"@ionic-native/launch-navigator": "^4.5.3",
"@ionic-native/network": "^4.5.3",
"@ionic-native/photo-library": "^4.3.3",
"@ionic-native/splash-screen": "3.12.1",
"@ionic-native/status-bar": "^3.12.1",
"@ionic/app-scripts": "^3.1.2",
"@ionic/storage": "2.0.1",
"@jiguang-ionic/jpush": "^1.0.2",
"angularfire2": "^5.0.0-rc.5.6-next",
"com.darktalker.cordova.screenshot": "0.1.6",
"com.lampa.startapp": "git+https://github.com/lampaa/com.lampa.startapp.git",
"com.synconset.imagepicker": "~2.1.8",
"cordova-android": "6.3.0",
"cordova-clipboard": "^1.1.1",
"cordova-ios": "~4.5.4",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-add-swift-support": "^1.6.0",
"cordova-plugin-alipay-v2": "0.0.4",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-appavailability": "^0.4.2",
"cordova-plugin-appminimize": "^1.0.0",
"cordova-plugin-background-mode": "^0.7.2",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-dialogs": "^2.0.1",
"cordova-plugin-file": "^4.3.3",
"cordova-plugin-file-opener2": "^2.0.19",
"cordova-plugin-file-transfer": "^1.6.3",
"cordova-plugin-fullscreen": "^1.2.0",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-jcore": "^1.1.10",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-photo-library": "^2.1.0",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-telerik-imagepicker": "^2.1.8",
"cordova-plugin-wechat": "^2.0.0",
"cordova-plugin-whitelist": "^1.3.1",
"ion-multi-picker": "^2.1.2",
"ionic-angular": "3.6.1",
"ionic-plugin-keyboard": "^2.2.1",
"ionic2-city-picker": "0.0.11",
"ionic2-super-tabs": "^4.2.2",
"ionicons": "3.0.0",
"jpush-phonegap-plugin": "^3.2.12",
"node-sass": "^4.7.2",
"platform": "1.3.5",
"resource": "0.8.1",
"rxjs": "5.4.0",
"setimmediate": "^1.0.5",
"sw-toolbox": "3.6.0",
"ts-md5": "^1.2.2",
"uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.1.2",
"zone.js": "0.8.12"
},
"devDependencies": {
"@angular/tsc-wrapped": "^4.4.6",
"typescript": "2.3.4"
},

Linking to Facebook

I am trying to get the facebook id for a large number of people. I can do it using a site like http://findmyfbid.com/ which is great to get one, but I need to get it for several hundred.

This is for an app, I am using cordova, and I am trying to get the appavailability plugin to work so that when someone clicks on a facebook link it will open the link in the facebook app instead of a browser. The plugin works great, but if I use the link as facebook.com/username, it will open the facebook app but just to my personal feed. If I use facebook.com/(facebook id number), it will open correctly to the the user's page.

I think my solution is to be able to get the id's for everyone and just use those as a link. It would be fine if I could get the username link to work somehow with appavailability. I am using the code from this question: http://stackoverflow.com/questions/23095906/how-to-open-twitter-and-facebook-app-with-phonegap

appAvailability is not defined

I have used this wonderful plug-in on a couple of Android apps.

Recently I noticed I was getting the following error "appAvailability is not defined"

After researching it, I found that it is happening on Android 6+. When I install the app on Android 5 it works.

Any ideas how to correct this issue?

iOS callback never executes in v0.2.1 on PG 3.3

Hi,

I'm trying to use version 0.2.1 of this plugin in a Phonegap Build app using Phonegap 3.3:

<preference name="phonegap-version" value="3.3.0"/>
....
<gap:plugin name="com.ohh2ahh.plugins.appavailability" version="0.2.1"/>

And everything seems to load fine, from a JS perspective, but the callback never seems to fire. Here's a screenshot of manual execution of the calls through Safari's remote debugger while the app is running on a iPhone 5 iOS 7.1, and you can see that nothing is ever logged to the console: http://cl.ly/image/1J3d3t3H0r1W

Have you seen anything like this before that might cause it to just never execute the callback? For now, I have built in a 250ms failsafe that assumes the app is not available and sticks with opening Fb/Twitter in childBrowser, but would love to get the native app functionality working.

Thanks!

I cannot get it to work

Hi. In my setup the plugin is not working. I verified that the object AppAvailability is undefined.

I tried the sample code provided in the docs, but I cannot get it to work due to the AppAvailability object undefined. I was able to get other plugins working, so it might not be a general issue.

I am missing something obvious with your plugin? I'm using PhoneGap Build service.

I also opened a thread on Adobe PhoneGap Build forum: http://community.phonegap.com/nitobi/topics/appavailability-wont-work

Return text error

Hello,

I am using this plugin with ionic and it is working with promises.
The resolve is called on success callback and the reject on callback failure

Rejecting a promise with empty error could be problematic if we want to perform some logic. Here is an example:

private method() : Promise<boolean>{
return this.appAvailability.check("fb//")
.then(() => this.doSomething())
.catch(err => console.error(err))
}

Here we can see that if doSomething reject as well with "" we cannot perform logic.

Is it possible to add a text in the error:
Example: "app_not_available"

https://github.com/ohh2ahh/AppAvailability/blob/master/src/android/AppAvailability.java#L42

For IOS I don't know how it works...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.