The android module contains android-specific functionality. Right now, this includes lifecycle management, key mapping, and vibrator functions.
This should be called on a regular basis to check to see if Android expects the game to pause. If it return true, the game should call android.wait_for_resume(), after persisting its state as necessary.
This function should be called after android.check_pause() returns true. It does not return until Android has resumed from the pause. While in this function, Android may kill a game without further notice.
This maps between an android keycode and a python keysym. The android keycodes are available as constants in the android module.
Causes the phone to vibrate for s seconds. This requires that your application have the VIBRATE permission.
Enables (if enable is true) or disables the device’s accelerometer.
Returns an (x, y, z) tuple of floats that gives the accelerometer reading, in meters per second squared. See this page for a description of the coordinate system. The accelerometer must be enabled before this function is called. If the tuple contains three zero values, the accelerometer is not enabled, not available, defective, has not returned a reading, or the device is in free-fall.
Returns the screen density in dots per inch.
Shows the soft keyboard.
Hides the soft keyboard.
The android_mixer module contains a subset of the functionality in found in the pygame.mixer module. It’s intended to be imported as an alternative to pygame.mixer, using code like:
try:
import pygame.mixer as mixer
except ImportError:
import android_mixer as mixer
The android_mixer module is a wrapper around the Android MediaPlayer class. This allows it to take advantage of any hardware acceleration present, and also eliminates the need to ship codecs as part of an application.
It has several differences from the pygame mixer:
The android_mixer module hasn’t been tested much, and so bugs may be present.
The following pygame modules are present. Not all functionality is supported on Android.
pygame
pygame.base
pygame.bufferproxy
pygame.colordict
pygame.color
pygame.compat
pygame.constants
pygame.cursors
pygame.display
pygame.draw
pygame.event
pygame.fastevent
pygame.font
pygame.gfxdraw
pygame.imageext
pygame.image
pygame.joystick
pygame.key
pygame.locals
pygame.mask
pygame.mouse
pygame.overlay
pygame.rect
pygame.rwobject
pygame.sprite
pygame.surface
pygame.surflock
pygame.sysfont
pygame.time
pygame.transform
pygame.version
The following Python modules are present. Not all functionality is supported on Android.
_abcoll
abc
aliases
array
ast
atexit
base64
bisect
binascii
calendar
cmath
codecs
collections
compileall
contextlib
copy
copy_reg
cStringIO
cPickle
datetime
difflib
dis
dummy_threading
dummy_thread
encodings
encodings.raw_unicode_escape
encodings.utf_8
encodings.zlib_codec
errno
fcntl
fnmatch
functools
__future__
genericpath
getopt
glob
gzip
hashlib
heapq
httplib
inspect
itertools
keyword
linecache
math
md5
mimetools
opcode
optparse
os
operator
parser
pickle
platform
posix
posixpath
pprint
py_compile
pwd
Queue
random
repr
re
rfc822
select
sets
shlex
shutil
site
socket
sre_compile
sre_constants
sre_parse
ssl
stat
StringIO
string
struct
subprocess
symbol
symtable
strop
tarfile
tempfile
textwrap
_threading_local
threading
time
tokenize
token
traceback
types
urllib
urllib2
urlparse
UserDict
warnings
weakref
webbrowser
zipfile
zipimport
zlib