added method to get versionCode of mobile app to JSInterface
This commit is contained in:
@ -47,6 +47,8 @@ window.plugin.userLocation.setup = function() {
|
|||||||
|
|
||||||
window.plugin.userLocation.updateLocation = function(lat, lng) {
|
window.plugin.userLocation.updateLocation = function(lat, lng) {
|
||||||
var latlng = new L.LatLng(lat, lng);
|
var latlng = new L.LatLng(lat, lng);
|
||||||
|
var foo = android.getVersionCode();
|
||||||
|
window.console.log('version code: ' + foo);
|
||||||
window.plugin.userLocation.marker.setLatLng(latlng);
|
window.plugin.userLocation.marker.setLatLng(latlng);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ import android.content.DialogInterface;
|
|||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.JavascriptInterface;
|
import android.webkit.JavascriptInterface;
|
||||||
@ -79,6 +81,19 @@ public class IITC_JSInterface {
|
|||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public int getVersionCode() {
|
||||||
|
int versionCode = 0;
|
||||||
|
try {
|
||||||
|
PackageInfo pInfo = mContext.getPackageManager()
|
||||||
|
.getPackageInfo(mContext.getPackageName(), 0);
|
||||||
|
versionCode = pInfo.versionCode;
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return versionCode;
|
||||||
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void switchToPane(String id) {
|
public void switchToPane(String id) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user