private void buildApplicationData(Context context) throws JSONException {
        app = new JSONObject();
        app.put("package", context.getPackageName());
        try {
            PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            app.put("versionCode", info.versionCode);
            app.put("versionName", info.versionName);
            // TODO firstInstallTime and lastUpdate
        } catch (NameNotFoundException e) {
            // Cannot happen as we're checking a know package.
        }
    }
private void buildApplicationData ( Context context ) throws JSONException { app = new JSONObject ( ) ; app . put ( "package" , context . getPackageName ( ) ) ; try { PackageInfo info = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , 0 ) ; app . put ( "versionCode" , info . versionCode ) ; app . put ( "versionName" , info . versionName ) ; } catch ( NameNotFoundException e ) { } }
Adds the application data to the report.
@param context
@throws JSONException if the application data cannot be added