我们正在开发一个 Android 商店。它是一个基于 Spring 的原型,用于后端,对于客户端,我们使用开源项目 Aurora:https ://gitlab.com/AuroraOSS/AuroraStore
我们必须存储一些关于我们在 Nexus 中上传的 apk 的信息。我们的第一个问题是如何在 Spring 应用程序中读取 AndroidManifest.xml?有没有可用的maven模块?
第二个问题是我们如何管理数据库中的 Android 信息?例如,我们在 Android Studio 下有通常用于 Java Android 项目的 PackageInfo。但是我们必须为一个应用程序存储这些信息吗?我们怎么能点呢?
package android.content.pm;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import androidx.annotation.RecentlyNonNull;
public class PackageInfo implements Parcelable {
@RecentlyNonNull
public static final Creator<PackageInfo> CREATOR = null;
public static final int INSTALL_LOCATION_AUTO = 0;
public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1;
public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2;
public static final int REQUESTED_PERMISSION_GRANTED = 2;
public ActivityInfo[] activities;
public ApplicationInfo applicationInfo;
public int baseRevisionCode;
public ConfigurationInfo[] configPreferences;
public FeatureGroupInfo[] featureGroups;
public long firstInstallTime;
public int[] gids;
public int installLocation = 1;
public InstrumentationInfo[] instrumentation;
public boolean isApex;
public long lastUpdateTime;
public String packageName;
public PermissionInfo[] permissions;
public ProviderInfo[] providers;
public ActivityInfo[] receivers;
public FeatureInfo[] reqFeatures;
public String[] requestedPermissions;
public int[] requestedPermissionsFlags;
public ServiceInfo[] services;
public String sharedUserId;
public int sharedUserLabel;
/** @deprecated */
@Deprecated
public Signature[] signatures;
public SigningInfo signingInfo;
public String[] splitNames;
public int[] splitRevisionCodes;
/** @deprecated */
@Deprecated
public int versionCode;
public String versionName;
public PackageInfo() {
throw new RuntimeException("Stub!");
}
public long getLongVersionCode() {
throw new RuntimeException("Stub!");
}
public void setLongVersionCode(long longVersionCode) {
throw new RuntimeException("Stub!");
}
public String toString() {
throw new RuntimeException("Stub!");
}
public int describeContents() {
throw new RuntimeException("Stub!");
}
public void writeToParcel(Parcel dest, int parcelableFlags) {
throw new RuntimeException("Stub!");
}
}
提前致谢。
编辑:要读取 apk 元数据,我们找到了这个模块: https ://github.com/hsiafan/apk-parser
<dependency>
<groupId>net.dongliu</groupId>
<artifactId>apk-parser</artifactId>
<version>2.6.9</version>
</dependency>