Skip to content

Instantly share code, notes, and snippets.

@Nithanim
Last active September 14, 2024 16:56
Show Gist options
  • Save Nithanim/18448acbe400b1fb83ff39c8d43a0452 to your computer and use it in GitHub Desktop.
Save Nithanim/18448acbe400b1fb83ff39c8d43a0452 to your computer and use it in GitHub Desktop.
Install an app without google play that checks if it was installed via google play

There are some apps that check if they were installed via google play. Apps can even refuse to run if they detect that they were not. This can be a problem for you if you install apps via the aurora store ore manually.

To work around this people found a very dumb workaround that you might even dismiss if you read it the first time. Basically, it boils down to summing up the file sizes of the individual apks and give that to the package installer. This also works if you already installed the app and it refuses to run. You can just install/update over he existing one even if it is the same version.

Bsically this: https://www.reddit.com/r/Austria/comments/p8qd8y/wie_man_die_george_app_auch_ohne_google_play_zum/

You need to get the app "Package Manager" (com.smartpack.packagemenager). With it, you can extract an installed app into an apkm.

Then, basically the script attached to this gist takes over. Its goal is to

#!/system/bin/sh
set -e
if [ -n "${BASH_VERSION}" ]
then
echo "BASH must be used, current shell is $SHELL"
exit 1
fi
# REPLACE THE NAMES HERE IF YOU USE SOME OTHER APP!
source_apkm=/storage/emulated/0/Package_Manager/at.erstebank.george_*.apkm
echo "Using file $source_apkm"
# THE ANDROID PM IS PICKY ABOUT THE FOLDER FROM WHERE STUFF IS INSTALLED
temp_dir="/data/local/tmp/instworkaround"
echo "Using $temp_dir as temp dir"
mkdir -p "$temp_dir"
rm -f "$temp_dir/*"
unzip "$source_apkm" -d "$temp_dir"
# SUM UP THE SIZES OF THE FILES
sum=0
for f in *.apk; do
name=$(stat -c "%n" "$f")
size=$(stat -c "%s" "$f")
echo "Using file "$name" with size $size"
sum=$(($sum+$size))
done
echo "File size sum is $sum"
# PASS THE SUM TO THE INSTALLER
echo "Creation a special PM session"
line=$(pm install-create -S $sum -i "com.android.vending")
echo "PM output is: $line"
# EXTRACT THE SESSION ID FROM THE MESSAGE
regex="[^\[]*\[([0-9]+)\].*"
if [[ $line =~ $regex ]]
then
sessionid="${BASH_REMATCH[1]}"
echo "Session id is $sessionid"
else
echo "Cannot get session id!"
exit 2
fi
# GIVE THE FILES TO THE INSTALLER
echo "Passing individual apks to PM..."
number=0
for f in *.apk; do
name=$(stat -c "%n" "$f")
size=$(stat -c "%s" "$f")
echo "Passing file "$name" of size $size"
pm install-write -S $size "$sessionid" $number "$f"
number=$(($number+1))
done
# CONCLUDE THE INSTALLATION
echo "Committing installation with PM"
pm install-commit $sessionid
echo "Installation completed, app should now work!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment