android-app-docker/Makefile.make.new-app.sh

98 lines
3.9 KiB
Bash
Executable file

#!/bin/bash
set -xe
#APP_NAME
while test -z "${APP_NAME:-}"
do
read -p "Please provide a Name for the Android App:" APP_NAME
done
#APP_PACKAGE
while test -z "${APP_PACKAGE:-}"
do
APP_PACKAGE_DEFAULT="${APP_NAME,,}"
APP_PACKAGE_DEFAULT="${APP_PACKAGE_DEFAULT//[!a-z0-9]/_}"
read -p "Please provide a Package.Name for the App [default=$APP_PACKAGE_DEFAULT]:" APP_PACKAGE
APP_PACKAGE="${APP_PACKAGE:-$APP_PACKAGE_DEFAULT}"
APP_PACKAGE="${APP_PACKAGE,,}"
APP_PACKAGE="${APP_PACKAGE//[!a-z0-9\.]/}"
test -d "apps/$APP_PACKAGE" && {
echo "There is already an app with APP_PACKAGE '$APP_PACKAGE'. Choose other APP_PACKAGE name" >&2
APP_PACKAGE=""
}
done
#APP_TARGET_VERSION
while test -z "${APP_TARGET_VERSION:-}"
do
cat << API_LEVEL
read -p "Please choose the APP_TARGET_VERSION Apilevel:'
35 = Android 15 = 2024
34 = Android 14 = 2023
33 = Android 13 = 2022
32 = Android 12L = 2022
31 = Android 12 = 2021
30 = Android 11 = 2020
20 = Android 10 = 2019
(see https://apilevels.com/ for more info)
API_LEVEL
APP_TARGET_VERSION_DEFAULT="33"
read -p "Please choose [default=$APP_TARGET_VERSION_DEFAULT]:" APP_TARGET_VERSION
APP_TARGET_VERSION="${APP_TARGET_VERSION:-$APP_TARGET_VERSION_DEFAULT}"
test "$APP_TARGET_VERSION" -gt 0 || {
echo "Error: APP_TARGET_VERSION 'APP_TARGET_VERSION' is not valid"
APP_TARGET_VERSION='';
}
done
cat << INFO
Creating an skeleton for an Android app with the following info:
APP_PACKAGE: ${APP_PACKAGE}
APP_NAME: ${APP_NAME}
INFO
mkdir -p "apps/$APP_PACKAGE"
cat > "apps/$APP_PACKAGE/AndroidManifest.xml" << ANDROIDMANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="$APP_PACKAGE"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="30"
android:targetSdkVersion="33"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS"/>
<uses-permission android:name="android.permission.MANAGE_MEDIA"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
<application android:label="HIHIHOHO" android:icon="@drawable/ic_launcher">
<activity android:name="app.example.ExampleApp"
android:exported="true"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
ANDROIDMANIFEST