Some way to detect version of Android app from JavaScript?

瀏覽次數:2,321 次
跳到第一則未讀訊息

pamela fox

未讀,
2011年12月13日 下午5:18:012011/12/13
收件者:phonegap
Hey there-

To help me in debugging problems that users encounter in my PhoneGap
Android app, I currently log device information using the phonegap
API. I would also like to log what version they are using (per what's
in AndroidManifest.xml). Is this something that can be exposed to my
JavaScript from PhoneGap?
Otherwise I'll do some sort of make script that writes the version
number programmatically to the XML and the JS. Thanks!

- pamela

Dan Shookowsky

未讀,
2011年12月13日 晚上10:57:152011/12/13
收件者:phonegap
Please look at the PhoneGap documentation for the Device object. It
should provide all the information you need.

http://docs.phonegap.com/en/1.2.0/phonegap_device_device.md.html#Device

Dan Shookowsky

未讀,
2011年12月13日 晚上11:05:512011/12/13
收件者:phonegap
Oops...just read your email again and see that you're looking for
software version information rather than hardware information. You
could build a plugin to return the application version.

take a look at http://www.practicaldeveloper.net/2011/09/creating-plugin-with-phonegap-10.html

then create a plugin class that returns version from:

import android.content.pm.PackageManager.NameNotFoundException;
try {
//recall in the manifest version number is simply a sequential
integer identifying versions. Version name is a string like "1.0" or
"2.1", etc that is more
//commonly associated with a version identifier.
String version =
getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
} catch (NameNotFoundException e) {
Log.e("tag", e.getMessage());
}

On Dec 13, 5:18 pm, pamela fox <pamela...@everyday.io> wrote:

回覆所有人
回覆作者
轉寄
訊息已遭刪除
0 則新訊息