PackageInfoBuilder


public final class PackageInfoBuilder


Builder for PackageInfo.

Summary

Public methods

PackageInfoBuilder
addRequestedPermission(
    String requestedPermission,
    int requestedPermissionFlag
)

Adds a requested permission and its flag for the app.

PackageInfo

Returns a PackageInfo with the provided data.

static PackageInfoBuilder

Start building a new PackageInfo.

PackageInfoBuilder

Sets the application info.

PackageInfoBuilder
setPackageName(String packageName)

Sets the package name.

PackageInfoBuilder
@TargetApi(value = Build.VERSION_CODES.P)
setVersionCode(long longVersionCode)

Sets the version code.

PackageInfoBuilder
setVersionName(String versionName)

Sets the version name.

Public methods

addRequestedPermission

public PackageInfoBuilder addRequestedPermission(
    String requestedPermission,
    int requestedPermissionFlag
)

Adds a requested permission and its flag for the app.

This can be called several times to add multiple permissions.

build

public PackageInfo build()

Returns a PackageInfo with the provided data.

newBuilder

public static PackageInfoBuilder newBuilder()

Start building a new PackageInfo.

Returns
PackageInfoBuilder

a new instance of PackageInfoBuilder.

setApplicationInfo

public PackageInfoBuilder setApplicationInfo(ApplicationInfo applicationInfo)

Sets the application info.

Default is null

See also
applicationInfo

setPackageName

public PackageInfoBuilder setPackageName(String packageName)

Sets the package name.

Default is null.

See also
packageName

setVersionCode

@TargetApi(value = Build.VERSION_CODES.P)
public PackageInfoBuilder setVersionCode(long longVersionCode)

Sets the version code.

On SDK P+, this value will be returned for both getLongVersionCode and versionCode. Note that the value of versionCode will be truncated if a value larger than Integer.MAX_VALUE is provided.

Default is 0L.

setVersionName

public PackageInfoBuilder setVersionName(String versionName)

Sets the version name.

Default is null.

See also
versionName