sampart / cordova-plugin-app-version Goto Github PK
View Code? Open in Web Editor NEWCordova plugin to return the version number of the current app [not maintained]
License: MIT License
Cordova plugin to return the version number of the current app [not maintained]
License: MIT License
this plugin can maybe set values
setVersionNumber(), setVersionNumber() ...etc?? is it possible?
On the windows platform when I add this plugin I get the error
module cordova/windows8/commandproxy not found
I installed using the cordova CLI
Similar to getAppName
hi @rjmunro
according to this
http://phonegap.com/blog/2015/05/26/npm-plugins-available/
http://cordova.apache.org/announcements/2015/04/21/plugins-release-and-move-to-npm.html
so...just want to inform you that your plugin should be move to npm in the future...
I finally got this installed. (I think)
Build an android apk.
All the values are empty (version, build, name, package).
I need to check the source... is this pulling the data from the config name, version or from some android name?
Literally keeping the codebase the same apart from the two versions between 0.1.8
and 0.1.7
. iOS 4.0.1 on Cordova 6.0.0.
I get no errors, but for some reason, the body tag is replaced with the gap://ready
iframe.
I wonder if there is a script error or something in the plugin causing cordova.js
to fallback to rendering the iframe.
Getting following error on install
Any suggestions ?
Error: Failed to fetch plugin git+https://github.com/whiteoctober/cordova-plugin-app-version.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
//show the App version
if (ionic.Platform.isIOS() || ionic.Platform.isAndroid()) {
$cordovaAppVersion.getAppVersion().then(function (version) {
$scope.appVersion = version;
});
}
The above code works fine in android but somehow doesn't work in iOS
Saw the comment here http://forum.ionicframework.com/t/cordovaappversion-is-not-working/18695/4
but using $cordovaAppVersion.getVersionNumber() just simply doesn't work in both android and iOS
Thanks for helping me out here
Hi
i'm using the following hook to update the android:versionCode in my AndroidManifest.xml:
http://eclipsesource.com/blogs/2015/04/07/an-apache-cordova-hook-to-auto-bump-ios-cfbundleversion-and-android-versioncode/
So after this hook this file looks like that (timestamp): android:versionCode="140420151246"
If i get the appVersion it looks good. But the AppCode is a negative number like: -1313769522.
Where does this come from? Shouldn't it be the timestamp defined in versionCoode?
regards
angela
Hi
my app version is 114 (1.032) in itunes connect, but the plugin only returns 114.
It should return the same number as the one set up in config.xml : 1.032
Thanks
After the call in android:
cordova.getAppVersion().then(function (version) {
// callback - do something
});
the app crashes
Would appreciate any insight.
Didn't work in 3.0 so I modified it and shared.
Tim
@interface AppVersion : CDVPlugin
@implementation AppVersion
(void)getVersionNumber:(CDVInvokedUrlCommand*)command
{
NSString* callbackId = command.callbackId;
NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
CDVPluginResult* pluginResult = nil;
NSString* javaScript = nil;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:version];
javaScript = [pluginResult toSuccessCallbackString:callbackId];
[self writeJavascript:javaScript];
}
I think this should be "standard" for any apache cordova app.
Maybe u can "donate" the code to apache cordova folks to be renamed as official apache.cordova.appversion or something?
Using PhoneGap version: 3.6.0-0.21.19, Android: 4.4.4
After the call:
cordova.getAppVersion().then(function (version) {
// callback - do something
});
it starts executing the callback, and then it issues an error seen in Eclipse logical:
"processMessage failed: Message: S01 AppVersion970924709 s1.0.0", source: file:///android_asset/www/cordova.js (1060)
ans stops executing the callback
Would appreciate any insight.
Not work on Android 5.1.1, Samsung S5 G900M
Just installed this plugin and it's working fine on Android but when viewed on iOS it displays as 'null'. This is using an iPhone 4S with iOS version 7.1.1.
Any ideas on how to get the version number displaying correctly?
$ cordova plugin add cordova-plugin-app-version
Fetching plugin "cordova-plugin-app-version" via npm
Installing "cordova-plugin-app-version" for ios
Failed to install 'cordova-plugin-app-version':TypeError: Uh oh!
Object # has no method 'parse'
at handlers.js-module.install (/Users/emmychen/cordova/ionic/mathwp/platforms/ios/cordova/lib/plugman/pluginHandlers.js:156:66)
at Object.ActionStack.process (/Users/emmychen/cordova/ionic/mathwp/platforms/ios/cordova/node_modules/cordova-common/src/ActionStack.js:56:25)
at Plugman.addPlugin (/Users/emmychen/cordova/ionic/mathwp/platforms/ios/cordova/lib/plugman/Plugman.js:82:20)
at Api.addPlugin (/Users/emmychen/cordova/ionic/mathwp/platforms/ios/cordova/Api.js:187:53)
at handleInstall (/opt/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:601:6)
at /opt/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:385:28
at _fulfilled (/opt/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/opt/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/opt/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
at /opt/local/lib/node_modules/cordova/node_modules/q/q.js:509:49
Error: Uh oh!
Object # has no method 'parse'
i'm trying to install this plugin with my cordova version 6.0.0 but this is giving me some parse error. Earlier it was working fine with cordova version 5.1.1. Complete logs of error is listed below. need urgent help for my project
Failed to install 'cordova-plugin-app-version':TypeError: Uh oh!
Object # has no method 'parse'
at handlers.js-module.install (/Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/cordova/platforms/android/cordova/lib/pluginHandlers.js:142:66)
at Object.ActionStack.process (/Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/cordova/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25)
at Api.addPlugin (/Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/cordova/platforms/android/cordova/Api.js:205:20)
at handleInstall (/Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:601:6)
at /Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:385:28
at _fulfilled (/Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/node_modules/cordova/node_modules/q/q.js:749:13)
at /Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/node_modules/cordova/node_modules/q/q.js:509:49
at flush (/Users/abdulmuneeb/Documents/Development/prometheus/unionconnect-phone/node_modules/cordova/node_modules/q/q.js:108:17)
Error: Uh oh!
Object # has no method 'parse'
If wp8 platform is supported install errors. Plugin works fine in Android tho
jose@mint ~/NFC_Ring_Control $ cordova plugin add https://github.com/whiteoctober/cordova-plugin-app-version.git
Fetching plugin from "https://github.com/whiteoctober/cordova-plugin-app-version.git"...
Starting installation of "uk.co.whiteoctober.cordova.AppVersion" for android
Preparing android project
uk.co.whiteoctober.cordova.AppVersion installed on android.
Starting installation of "uk.co.whiteoctober.cordova.AppVersion" for wp8
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
TypeError: Cannot read property 'currentVersion' of null
at checkEngines (/usr/local/lib/node_modules/cordova/node_modules/plugman/src/install.js:68:35)
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:526:49
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
jose@mint ~/NFC_Ring_Control $
https://github.com/chrisekelley/Version is Android only but works on Phonegap Build, and allows to get both the application version name, as well as the build number.
I installed the plugin correctly and got the desired result on Android but not in the browser version.
When I run the following code:
cordova.getAppVersion.getVersionNumber(function (version) {
alert(version);
});
This trows the error:
Error: exec proxy not found for :: AppVersion :: getVersionNumber
Am I doing something wrong or isn't really working with the browser platform?
im trying to use this pluggin but i get this error Typeerror: cordova.getAppVersion is not function , can you help me?
Hi,
In future, do you distribute your plugin with npmjs.com repository
I find this one in my first research https://www.npmjs.com/package/cordova-plugin-appversion but it's not you :-)
Regards.
As far as I can see all the calls to actually get the version from the OS/Package are sync anyways. Why is this plugin then exposing an async calling pattern?
Wouldn't cordova.appversion.xxx
be easier to call?
hi @rjmunro
when I use "getAppName","getPackageName","getVersionCode"
in android and iOS,work perfect
but in wp8,it will trigger "nothing" (no any reflect),is it because wp8 not ready to support these attribute ?
I'm seeing the following deprecation warnings when trying to build an app on Cordova 3.6.3 with this plugin:
.../Plugins/uk.co.whiteoctober.cordova.appversion/AppVersion.m:16:32: warning: 'toSuccessCallbackString:' is deprecated: Deprecated in Cordova 3.6. Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0 [-Wdeprecated-declarations]
javaScript = [pluginResult toSuccessCallbackString:callbackId];
^
In file included from .../platforms/ios/.../Plugins/uk.co.whiteoctober.cordova.appversion/AppVersion.m:1:
In file included from .../platforms/ios/.../Plugins/uk.co.whiteoctober.cordova.appversion/AppVersion.h:1:
In file included from .../platforms/ios/build/emulator/include/Cordova/CDVPlugin.h:22:
.../platforms/ios/build/emulator/include/Cordova/CDVPluginResult.h:67:1: note: method 'toSuccessCallbackString:' declared here
- (NSString*)toSuccessCallbackString:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0");
^
.../platforms/ios/.../Plugins/uk.co.whiteoctober.cordova.appversion/AppVersion.m:18:11: warning: 'writeJavascript:' is deprecated: Deprecated in Cordova 3.6. Use the CDVCommandDelegate equivalent of evalJs:. This will be removed in 4.0.0 [-Wdeprecated-declarations]
[self writeJavascript:javaScript];
^
In file included from .../platforms/ios/.../Plugins/uk.co.whiteoctober.cordova.appversion/AppVersion.m:1:
In file included from .../platforms/ios/.../Plugins/uk.co.whiteoctober.cordova.appversion/AppVersion.h:1:
.../platforms/ios/build/emulator/include/Cordova/CDVPlugin.h:61:1: note: method 'writeJavascript:' declared here
- (NSString*)writeJavascript:(NSString*)javascript CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of evalJs:. This will be removed in 4.0.0");
^
2 warnings generated.
Hi,
Are you planning to submit your plugin on build.phonegap.com ?
Thanks
hi
I saw in cordova.io have a new version 0.1.5
http://plugins.cordova.io/#/package/uk.co.whiteoctober.cordova.appversion
but in this page only update to 0.1.4
https://build.phonegap.com/plugins/984
so...is there any difference or update information ?
I'm getting the error below when I navigate to a page after adding the AppVersion logic to it.
What am I missing?
I ran this statement
npm install --save @ionic-native/app-version
And then added the following logic to the settings.ts page
import { AppVersion } from '@ionic-native/app-version';
constructor(
public nav: NavController,
public translate: TranslateService,
public appVersion: AppVersion,
public auth: AuthService) {
appVersion.getVersionNumber().then(ver => {
this.appversion = ver;
}).catch(function(error) {
console.log(error);
});
}
main.js [sm]:1 ERROR Error: Uncaught (in promise): Error: No provider for AppVersion!
Error
at d (polyfills.js:3)
at injectionError (main.js [sm]:1)
at noProviderError (main.js [sm]:1)
at ReflectiveInjector_.throwOrNull (main.js [sm]:1)
at ReflectiveInjector.getByKeyDefault (main.js [sm]:1)
at ReflectiveInjector.getByKey (main.js [sm]:1)
at ReflectiveInjector.get (main.js [sm]:1)
at AppModuleInjector.NgModuleInjector.get (main.js [sm]:1)
at resolveDep (main.js [sm]:1)
at createClass (main.js [sm]:1)
at createDirectiveInstance (main.js [sm]:1)
at createViewNodes (main.js [sm]:1)
at createRootView (main.js [sm]:1)
at callWithDebugContext (main.js [sm]:1)
at Object.debugCreateRootView [as createRootView] (main.js [sm]:1)
at d (polyfills.js:3)
at injectionError (main.js [sm]:1)
at noProviderError (main.js [sm]:1)
at ReflectiveInjector_.throwOrNull (main.js [sm]:1)
at ReflectiveInjector.getByKeyDefault (main.js [sm]:1)
at ReflectiveInjector.getByKey (main.js [sm]:1)
at ReflectiveInjector.get (main.js [sm]:1)
at AppModuleInjector.NgModuleInjector.get (main.js [sm]:1)
at resolveDep (main.js [sm]:1)
at createClass (main.js [sm]:1)
at createDirectiveInstance (main.js [sm]:1)
at createViewNodes (main.js [sm]:1)
at createRootView (main.js [sm]:1)
at callWithDebugContext (main.js [sm]:1)
at Object.debugCreateRootView [as createRootView] (main.js [sm]:1)
at d (polyfills.js:3)
at l (polyfills.js:3)
at Object.reject (polyfills.js:3)
at Tab.NavControllerBase._fireError (main.js [sm]:1)
at Tab.NavControllerBase._failed (main.js [sm]:1)
at main.js [sm]:1
at t.invoke (polyfills.js:3)
at Object.onInvoke (main.js [sm]:1)
at t.invoke (polyfills.js:3)
at n.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (main.js [sm]:1)
at t.invokeTask (polyfills.js:3)
at n.runTask (polyfills.js:3)
Installing "cordova-plugin-app-version" for android
Failed to install 'cordova-plugin-app-version': Error: ENOENT: no such file or directory, open '/app/cordova/platforms/android/AndroidManifest.xml'
at Object.fs.openSync (fs.js:663:18)
at Object.fs.readFileSync (fs.js:568:33)
at Object.parseElementtreeSync (/app/cordova/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
at new AndroidManifest (/app/cordova/platforms/android/cordova/lib/AndroidManifest.js:29:20)
at AndroidProject.getPackageName (/app/cordova/platforms/android/cordova/lib/AndroidProject.js:99:12)
at Api.addPlugin (/app/cordova/platforms/android/cordova/Api.js:223:57)
at handleInstall (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:594:10)
at /app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28
at _fulfilled (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
(node:68912) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/app/cordova/platforms/android/AndroidManifest.xml'
at Object.fs.openSync (fs.js:663:18)
at Object.fs.readFileSync (fs.js:568:33)
at Object.parseElementtreeSync (/app/cordova/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
at new AndroidManifest (/app/cordova/platforms/android/cordova/lib/AndroidManifest.js:29:20)
at AndroidProject.getPackageName (/app/cordova/platforms/android/cordova/lib/AndroidProject.js:99:12)
at Api.addPlugin (/app/cordova/platforms/android/cordova/Api.js:223:57)
at handleInstall (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:594:10)
at /app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28
at _fulfilled (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
I'd like to know if this project is still supported.
Not sure if this is even possible using cordova, but it being able to get the build ID would mean things can be done when app is first launched after install. Could just check the build ID with the device's last recorded build ID to see if matches.
Hi guys.
Trying to use the plugin in my Android app. After embedding it into the app bundle noticed in logs that sometimes it returns undefined
instead of version value. I'm using Crosswalk/8.37.189.12, can it be the cause? Pasting several problematic UA strings:
Android 4.1.1; C1605 Build/11.3.A.3.1
Android 4.4.2; SM-N900 Build/KOT49H
Android 4.0.4; ZTE Grand Era Build/IMM76L
Android 4.1.2; GT-I9300 Build/JZO54K
Any thoughts?
UPDATE: it looks like this is a kind of sync issue. I see that the same phone got version=XXX
but on the second opening version=undefined
.
Hi,
Mat here, one of the current maintainers of this project.
Given that we no longer use Cordova in any of our active projects, it's becoming harder to give this plugin the time it needs.
I'm looking for some people to help out with the maintenance of this plugin. I can attempt to answer any questions you may have before volunteering.
Please comment on this issue if you're interested.
I'm confused on what is needed to get this to work.
I have ngCordova installed.
I have a link to the js file in my html.
I have the ngCordova services added.
angular.module('myApp', ['ngCordova'])
Now I install this plug in.
To use this plugin do I need the ngCordova AND $cordovaAppVersion ???
Do I need to add any JS anywhere?
I know there is something I'm missing but not sure where I'm off.
Update. I added in the JS.
Looks like its finding it, but then I get an error
AppVersionPlugin.js:65 Uncaught ReferenceError: module is not defined
at AppVersionPlugin.js:65
The line it has a problem with is
module.exports = getAppVersion;
AppVersion.m:24:32: 'toSuccessCallbackString:' is deprecated: Deprecated in Cordova 3.6. Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0
Hi,
I'm using the latest version of the plugin in a Cordova project. This is my code:
cordova.getAppVersion.getVersionNumber(function (version) {
$scope.versionNumber = version;
});
When using the emulator or a real device it all works well. But when using Ripple as the target, I get the following error:
What can be the problem? It's annoying because I use Ripple for most of development.
Thank you.
Hi
I'm using Phonegap 3.5 with the plugin but I can't get the app version.
My app is using angular and I'm trying to get the application version in the app.run method.
Its seems the the cordova.getAppVersion is undefined.
Thank you !
Please add the support for windows (Cordova 3.8.*). Not only wp8 and windows8.
Thx.
I hate to be this guy.. But my app has a bunch of WP users... Would be nice to have support for it... Sorry!
In ionic, I set config.xml: version="0.1.5"
appVersion.getVersionCode().then(function (versionCode) {
console.log(versionCode);
});
console output:105
version="0.1.15"
console output:115
there are some phones that output:1152
i intend to set up a set of check and update mechanism based on app version code. how should I set up the remote version number according to the version of ionic?
run the app,from console output the version code?
hi @rjmunro
according to this
https://build.phonegap.com/plugins/984
it said this plugin support in android, ios, winphone
I try PGB (build.phonegap.com) with your latest 0.1.4
but only android and ios work well,winphone have no any feedback (no wrong message too)
cordova.getAppVersion.getAppName().then(function (app_name) {
$log.debug(app_name)
});
cordova.getAppVersion.getPackageName().then(function (package_name) {
$log.debug(package_name)
});
cordova.getAppVersion.getVersionCode().then(function (version_code) {
$log.debug(version_code)
});
cordova.getAppVersion.getVersionNumber().then(function (version) {
$log.debug(version)
});
The above returns '2.0' for each iteration
I've just removed the plugin and added via git clone, I'm using this in angular
AngularJS's version troughs an exception. $q seems not to be defined on a global scope in AngularJS. Shouldn't you use an injector instead?
I'm talking about this piece of code:
} else if(window.angular){
dfr = $q.defer();
}
example :
alert(this.file.externalCacheDirectory); //returns proper directory when called above
this.appVersion.getPackageName().then(function (getPackageName) {
alert(getPackageName);
});
bit not getting alert if called like this
this.appVersion.getPackageName().then(function (getPackageName) {
alert(this.file.externalCacheDirectory);
});
i assume it clears everything in this.* if called once
There is some issue building for WP8.1+ in PGB. I get no errors and PGP says the plugin is correctly installed. Yet cordova.getAppVersion is undefined when trying to check version. I tried running my project using Visual Studio 2015 and everything worked just fine. Tested using WP10 device.
Any idea what is wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.