Coder Social home page Coder Social logo

xmartlabs / cordova-plugin-market Goto Github PK

View Code? Open in Web Editor NEW
86.0 45.0 38.0 11 KB

Cordova Plugin that allows you to access native Marketplace app (aka Google Play, App Store) from your app

License: MIT License

Java 61.80% Objective-C 25.47% JavaScript 12.73%

cordova-plugin-market's Introduction

cordova-plugin-market

Cordova (PhoneGap) 3.0+ plugin to open an application on native Marketplace app, aka Play Store for Android or App Store for iOS. Currently this plugin is compatible only with Android and iOS. Feel free to add support for the platform you need!

Installation

This plugin follows the Cordova 3.0 plugin spec, so it can be installed through the Cordova CLI in your existing Cordova project:

cordova plugin add https://github.com/xmartlabs/cordova-plugin-market

How to use it

When you want to open the device's store do this:

  • For Android use the app's package:

    cordova.plugins.market.open('your.app.package')

  • For iOS, first you need to create an easy-to-read link to your app using App Store Short Links, then use the app name

    cordova.plugins.market.open('yourappname')

This will open the link itms-apps://itunes.apple.com/app/yourappname. Alternatively you can use your app's id that should be similar to id284815942

You can also add a success and failure callback like this:

var appId = "...";
cordova.plugins.market.open(appId, {
  success: function() {
    // Your stuff here
  },
  error: function() {
    // Your stuff here
  }
})

When you want to search for apps with keyword:

  • For Android use the app's package:

    cordova.plugins.market.search('keyword')

  • For iOS, no support yet

You can also add a success and failure callback like this:

  var keyword = "gmail";
  cordova.plugins.market.search(keyword, {
    success: function() {
      // Your stuff here
    },
    error: function() {
      // Your stuff here
    }
  })

Release Notes

Version 1.2

  • Added API to search apps in Play Store (supported just in Android)

Version 1.1

  • Fixed issue due to use old iOS url.

Version 1.0

  • Initial release: support for open Play Store or iTunes with an Application ID

Contact

If you are using cordova-plugin-market in your app and have any suggestion or question:

Enrique Galindo, [email protected]

Miguel Revetria, [email protected]

@xmartlabs

cordova-plugin-market's People

Contributors

booleanbetrayal avatar bryant1410 avatar enrigalmig avatar ihadeed avatar m-revetria avatar sesubash 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

Watchers

 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

cordova-plugin-market's Issues

Open with developer id

I want to open all my apps under my developer id, but you don't have that option, please try to add it. It should help all developers.

NPM install calling plugman.fetch, overwrites custom config parameters

Thanks for creating this plugin. When we include it in our project's config.xml like so:

<plugin name="cordova-plugin-market" spec="~1.1.0" />

for some reason it installs itself using plugman.fetch during the $cordova prepare ios phase. the result is that custom configuration settings in the *-Info.plist are getting overwritten. we changed the line in our config.xml to install your plugin from git as so:

<plugin name="com.xmartlabs.cordova.market" spec="https://github.com/xmartlabs/cordova-plugin-market" />

and the problem goes away. is there something unusual about how we added it the first time, or is this something in your set up?

thanks again for making this plugin!

It doesn't work on iOS 8.3

Hi guys, thanks for your plugin, I haven't been able to make It works on iOS with this config:

  • cordova 5.0.0
  • cordova-android 3.6.4
  • cordova-ios 3.8.0

Testing on iPhone 5, ios 8.3

No problem with Android.

I have solved the problem using _itms-apps://_ protocol with opens the Appstore app correctly ;-)

if (device.platform === 'Android') {
    cordova.plugins.market.open('com.sportmaniacs.app');
} else if (device.platform === 'iOS') {
    window.location = "itms-apps://itunes.apple.com/app/<APPID>";
}

Error in Apple Store

Code:

cordova.plugins.market.open('instagram')

Result
img_0051

As the app in question is Instagram, I'm sure it exists in the store.

Erro execute open

I'm trying to use the plugin to redirect users to the store and update the application. On import I could only make it work as follows:

import { Market } from '@ionic-native/market/ngx';

In use I'm trying it as follows:

let id = 'br.com.packge'
this.market.open(id).then(response => {
console.debug(response);
}).catch(error => {
console.warn(error);
});

The more I have to return or the error:

ERROR TypeError: Object(...) is not a function

I'm doing something wrong, already reviewing all the import processes. I'm a beginner in Ionic and I can not find the source of the error, could anyone help me find where I'm going wrong?

pop up error 'to view this content, install and set up web browsing app' on Android device

I'm trying to use the plugin in my ionic app to redirect user to market place (Google Play, App Store).
It works on IOS, but not work on Android.
It shows the error 'to view this content, install and set up web browsing app' when my app redirect user to Google Play, anyone has idea on this?

// coding
import { Market } from '@ionic-native/market/ngx';
.......
constructor(private market: Market)
.......
openMarket(){
this.market.open('https://play.google.com/store/apps/details?id=com.nextmedia');
}

Invalid action error

I'm getting an Invalid actoin error when I call cordova.plugins.market.open(). What could be the reason?

In studio debug console I see an ActivityNotFoundException:
No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=in.hinote.mob.hrworks flg=0x10000000 }

Should I add any intent in the config.xml?

Open link in Google play market inside Mobomarket

Hello.
I use your plugin and it is work fine but when I download MoboMarket to my phone after click app open MoboMarket app. I do not want open this app. I want open my link in Google Play.

Do you have solution how do it?
Thanks

UI API called from background thread Group

Error Xcode

Main Thread Checker: UI API called on a background thread: -[UIApplication openURL:]
PID: 333, TID: 6566, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4 Colmena 0x0000000104a6556c __18-[CDVMarket open:]_block_invoke + 304
5 libdispatch.dylib 0x0000000104ecfbcc _dispatch_call_block_and_release + 32
6 libdispatch.dylib 0x0000000104ed16c0 _dispatch_client_callout + 20
7 libdispatch.dylib 0x0000000104ed40ec _dispatch_queue_override_invoke + 952
8 libdispatch.dylib 0x0000000104ee4ae0 _dispatch_root_queue_drain + 364
9 libdispatch.dylib 0x0000000104ee5488 _dispatch_worker_thread2 + 140
10 libsystem_pthread.dylib 0x00000001e23857d8 _pthread_wqthread + 216
11 libsystem_pthread.dylib 0x00000001e238c76c start_wqthread + 8
2021-03-10 18:08:57.553828-0300 Colmena[333:6566] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication openURL:]
PID: 333, TID: 6566, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4 Colmena 0x0000000104a6556c __18-[CDVMarket open:]_block_invoke + 304
5 libdispatch.dylib 0x0000000104ecfbcc _dispatch_call_block_and_release + 32
6 libdispatch.dylib 0x0000000104ed16c0 _dispatch_client_callout + 20
7 libdispatch.dylib 0x0000000104ed40ec _dispatch_queue_override_invoke + 952
8 libdispatch.dylib 0x0000000104ee4ae0 _dispatch_root_queue_drain + 364
9 libdispatch.dylib 0x0000000104ee5488 _dispatch_worker_thread2 + 140
10 libsystem_pthread.dylib 0x00000001e23857d8 _pthread_wqthread + 216
11 libsystem_pthread.dylib 0x00000001e238c76c start_wqthread + 8

Open AppStore not finding published app, while Play Store does

Hello.

I'm having no problems opening the Play Store from the app, but when I run it on iOS with the same package name, the AppStore returns an 'app not found' response. I've checked the apps bundle identifier with Xcode and it's com.appName.app. That bundle id works for the Play Store but not for the App Store.

I'm calling the method as explained in the doc: this.market.open('com.appName.app');

I don't know if I'm doing anything wrong in regards to using the plugin or if something is not working properly.

Error - Cannot open app store

Trying to use this in an iOS application. When I launch it opens up the app store app and then this message appears.

  • Ionic v4 w/angular 8
  • iOS 12 / iPhoneX

and the App ID is for sure correct. Testing is done on a real live device and the app was distributed via TestFlight - there is a production version of the app available on the app store.

main.js etc missing in ionic 3 /www/build

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request

Current behavior:
After installing cordova-plugin-market in ionic 3 and building, the /www/build folder only contains two files. The following files are missing: main.css, main.css.map, main.js, main.js.map

When running the app with 'ionic run android -lsc --device' this results in 404 errors when the app is run.

Expected behavior:
Correct files in /www/build

Steps to reproduce:
After I install cordova-plugin-market running the app via 'ionic run android -lsc --device' succeeds but the build folder only contains two files so the app fails with several 404 errors. The build output concludes with the following. There are no errors in the rest of the build output:

BUILD SUCCESSFUL

Total time: 25.622 secs

Built the following apk(s): 
..../platforms/android/build/outputs/apk/android-debug.apk

ANDROID_HOME=~/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

Skipping build...

Built the following apk(s): 
..../platforms/android/build/outputs/apk/android-debug.apk

Using apk: ..../platforms/android/build/outputs/apk/android-debug.apk

Package name: com.blah.blah

LAUNCH SUCCESS

The build folder is virtually empty

/www/build
    polyfills.js
    sw-toolbox.js

If I remove cordova-plugin-market and re-run, the /www/build looks correct:

/www/build
    main.css
    main.css.map
    main.js
    main.js.map
    polyfills.js
    sw-toolbox.js

Other information:
Ionic info

Cordova CLI: 6.5.0 
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: OS X El Capitan
Node Version: v6.10.0
Xcode version: Xcode 8.2.1 Build version 8C1002

package.json info:

  "dependencies": {
    "@angular/common": "4.0.2",
    "@angular/compiler": "4.0.2",
    "@angular/compiler-cli": "4.0.2",
    "@angular/core": "4.0.2",
    "@angular/forms": "4.0.2",
    "@angular/http": "4.0.2",
    "@angular/platform-browser": "4.0.2",
    "@angular/platform-browser-dynamic": "4.0.2",
    "@angular/platform-server": "4.0.2",
    "@ionic-native/action-sheet": "^3.6.1",
    "@ionic-native/app-preferences": "^3.6.1",
    "@ionic-native/app-version": "^3.6.1",
    "@ionic-native/camera": "^3.6.1",
    "@ionic-native/core": "^3.4.2",
    "@ionic-native/file": "^3.6.1",
    "@ionic-native/http": "^3.6.1",
    "@ionic-native/in-app-browser": "^3.6.1",
    "@ionic-native/market": "^3.10.3",
    "@ionic-native/media-capture": "^3.6.1",
    "@ionic-native/screen-orientation": "^3.6.1",
    "@ionic-native/social-sharing": "^3.6.1",
    "@ionic-native/splash-screen": "^3.6.1",
    "@ionic-native/status-bar": "^3.9.2",
    "@ionic-native/toast": "^3.8.1",
    "@ionic-native/transfer": "^3.6.1",
    "@ionic-native/video-editor": "^3.6.1",
    "@ionic/storage": "2.0.1",
    "compare-versions": "^3.0.0",
    "ionic-angular": "3.1.0",
    "ionic-native": "^2.9.0",
    "ionicons": "3.0.0",
    "portfinder": "^1.0.13",
    "raven-js": "^3.15.0",
    "reflect-metadata": "^0.1.10",
    "rxjs": "5.1.1",
    "setimmediate": "^1.0.5",
    "sw-toolbox": "3.4.0",
    "zone.js": "^0.8.5"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.4",
    "@ionic/app-scripts": "1.3.4",
    "@types/jasmine": "^2.5.47",
    "jasmine": "^2.6.0",
    "jasmine-core": "^2.6.2",
    "jasmine-ts": "^0.1.2",
    "karma": "^1.7.0",
    "karma-chrome-launcher": "^2.1.1",
    "karma-jasmine": "^1.1.0",
    "karma-phantomjs-launcher": "^1.0.4",
    "karma-typescript": "^3.0.2",
    "rollup-plugin-replace": "^1.1.1",
    "typescript": "~2.2.1"
  },
  "cordovaPlugins": [
    "es6-promise-plugin"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],

Config.xml

  ....
  <plugin name="com.xmartlabs.cordova.market" spec="~1.1"/>
</widget>

Open App Store with app name

hi everyone,

does the plugin works correctly for iOS? E.g. while trying to open App Store using itms-apps://itunes.apple.com/app/yourappname (obviously yourappname is the app name, no spaces, no uppercases) the app is not found

I see (https://developer.apple.com/library/archive/qa/qa1633/_index.html) that itunes.com url has been switched with appstore.com time ago

In fact, using appstore.com/apps does the trick

Am I missing something? Does the plugin needs an update (CDVMarket.m, line 23)?

Allow IOS market link setting

Hello!
At this moment, we've noticed that whenever you use the market plugin in IOS it will try to open itms-apps://itunes.apple.com/app/yourappname. The problem for us is that one of our apps is exclusive for the chinese app store, meaning that the link needs to add "cn/" before "app".
Is it possible to provide a config option for this?

search(keyword) is not working in ios

var keyword = "gmail";
cordova.plugins.market.search(keyword, {
success: function() {
// Your stuff here
},
error: function() {
// Your stuff here
}
})

Not working in ios.

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.