Skip to content

Instantly share code, notes, and snippets.

Avatar

River Yan riverfor

View GitHub Profile
View qpysl4a-qsl4aapp-sample.py
#qpy:quiet
#-*-coding:utf8;-*-
"""
This is a sample project which use SL4A UI Framework,
There is another Sample project: https://github.com/qpython-android/qpy-calcount
"""
import qpy
import androidhelper
import urllib.request as ur
from qsl4ahelper.fullscreenwrapper2 import *
View qpysl4a-qpyinterfacefacade-test.py
import qpy
import androidhelper as android
droid = android.Android()
print(droid.executeQPy(qpy.home+"/scripts3/speak.py").result)
View qpysl4a-preferencesfacade-test.py
import time
import androidhelper as android
droid = android.Android()
print(droid.prefGetAll().result)
View qpysl4a-mediaplayerfacade-test.py
import time
import androidhelper as android
droid = android.Android()
print(droid. mediaPlay("http://io.qpython.com.cn/forum/How_it_Began.mp3","test", True).result)
time.sleep(30)
print(droid.mediaPlayList().result)
print(droid.mediaPlayInfo("test").result)
droid.mediaPlayClose("test")
View qpysl4a-wififacade-test.py
import time
import androidhelper as android
droid = android.Android()
print(droid.wifiGetConnectionInfo().result)
print(droid.checkWifiState().result)
print(droid.wifiStartScan().result)
print(droid.wifiLockAcquireFull().result)
time.sleep(10)
print(droid.wifiGetScanResults().result)
View qpysl4a-wakelockfacade-test.py
import androidhelper as android
droid = android.Android()
print(droid.wakeLockAcquireFull().result)
print(droid.wakeLockRelease().result)
View qpysl4a-tonegeneratorfacade-test.py
import androidhelper as android
droid = android.Android()
print(droid.generateDtmfTones("18611588888").result)
View qpysl4a-speechrecognitionfacade-test.py
# -*- coding: utf-8 -*-
import androidhelper
import time
import qpy
droid = androidhelper.Android()
while True:
say = droid.recognizeSpeech(None, None, "test")
with open(qpy.tmp+"/hello.txt","a") as obj:
if say.result:
View qpysl4a-settingsfacade-screen-test.py
import qpy
import time
import androidhelper as android
droid = android.Android()
print(droid.getScreenTimeout().result)
droid.setScreenTimeout(20)
print(droid.getScreenTimeout().result)
#droid.recorderStop()
View qpysl4a-sensormanagerfacade-orientation-test.py
# -*- coding: utf-8 -*-
import androidhelper
import time
from math import radians
droid = androidhelper.Android()
droid.startSensingTimed(1, 250)
droid.startLocating()
i=0
while i<20:
gpsdata = droid.readLocation().result