lwc:programming:mobile:android

  • https://firebase.google.com/docs/cloud-messaging/android/client

from this source to set the position of the emulator: 

  • cd ~/.android/avd/<image name>
  • edit emulator-user.ini and set window.x and window.y

4.4.2 emulator won't rotate to landscape. To force rotation, load the camera app. Alternatively, this open source app apk is available online

4.0.3 emulator crashes with some message about the launcher. Set heat size higher and check the path to the skin. Details here

emulator keys

this explains how to get Google Play on an emulator. Note that play will be gone when the emulator restarts

to turn debug mode off:

  • in AndroidManifest.xml set <application android:debuggable=“false”
  • Cordova: in config.xml set <preference name=“loglevel” value=“ERROR” /> (normally it's DEBUG or nothing)

how to start an application with adb

The easy way to do splash screens for Android and maybe iOS is:

  • make a png file that is 2208×2208 with center (non-stretchable) image 1200×1200. Save in the root directory of the cordova project as splash.png
  • if you leave the splash screens where the utility puts them, they won't be used and they will be deleted. Instead move them outside of the platform directory. Follow this example config file: 
 <platform name="android">
      <allow-intent href="market:*" />
      <splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/>
      <splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/>
      <splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/>
      <splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/>
      <splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/>
      <splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/>
      <splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/>
      <splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/>
    </platform>
  • add the splashscreen plugin (it doesn't work without it): cordova plugin add cordova-plugin-splashscreen
  • iOS: splash screen work as-is without moving or renaming them and without any changes to the config.xml file.
  • This information was correct as of cordova 5.3.3
  • aapt in build-tools is your friend:
    • get package name: ./aapt dump badging /tmp/YOUR_APK_FILE|awk -F" " '/launchable-activity/ {print $2}'|awk -F"'" '/name=/ {print $2}
    • get default activity run on launch: ./aapt dump badging /tmp/YOUR_APK_FILE|awk -F" " '/launchable-activity/ {print $2}'|awk -F"'" '/name=/ {print $2}
  • lwc/programming/mobile/android.txt
  • Last modified: 2022/01/03 12:18
  • by John Harrison