info
App Information
Get app name, version, and configuration
getAppInfo()
Get basic app information
shift2appjs.getAppInfo()
Returns basic information about the app including name, version, and package.
Returns
String - JSON object with app information
// Get app info
const info = JSON.parse(shift2appjs.getAppInfo());
console.log("App Name:", info.appName);
console.log("Version:", info.versionName);
console.log("Version Code:", info.versionCode);
console.log("Package:", info.packageName);
console.log("Website:", info.website);
// Example output:
// {
// "appName": "My App",
// "packageName": "com.example.shift2appjs",
// "versionName": "1.2.0",
// "versionCode": 12,
// "website": "https://mywebsite.com"
// }
Check for Updates
// Compare with server version
async function checkForUpdates() {
const appInfo = JSON.parse(shift2appjs.getAppInfo());
const currentVersion = appInfo.versionCode;
const response = await fetch("/api/latest-version");
const latest = await response.json();
if (latest.versionCode > currentVersion) {
showUpdateDialog(latest.downloadUrl);
}
}
getConfig()
Get full app configuration
shift2appjs.getConfig()
Returns the complete app configuration including permissions, UI settings, and module settings.
Returns
String - JSON object with full configuration
// Get full config
const config = JSON.parse(shift2appjs.getConfig());
// Check permissions
if (config.permissions.camera) {
// Camera permission enabled
}
// Check UI settings
console.log("Orientation:", config.ui_settings.orientation);
console.log("Pull to refresh:", config.ui_settings.pull_to_refresh);
// Check AdMob settings
if (config.admob_settings.enabled) {
console.log("AdMob is enabled");
}