本文整理汇总了Python中android.AndroidService方法的典型用法代码示例。如果您正苦于以下问题:Python android.AndroidService方法的具体用法?Python android.AndroidService怎么用?Python android.AndroidService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android
的用法示例。
在下文中一共展示了android.AndroidService方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: import android [as 别名]
# 或者: from android import AndroidService [as 别名]
def build(self):
self.root = NotificationDemo(self)
if platform == 'android':
try:
self.service = autoclass(
'org.test.npexample.ServiceMyservice')
mActivity = autoclass(
'org.kivy.android.PythonActivity').mActivity
argument = ''
self.service.start(mActivity, argument)
except:
self.service = AndroidService(
'Sevice example', 'service is running')
self.service.start('Hello From Service')
else:
Window.system_size = cm(7), cm(12)
self.client.on_connect = self.on_connect
self.client.on_disconnect = self.on_disconnect
Clock.schedule_once(self.try_connecting, 0)
Clock.schedule_interval(self.handle_msg, 0.1)
# def skipp(*a):
# self.root.ids.sm.current = 'main'
# Clock.schedule_once(skipp, 0.5)
return self.root
示例2: start
# 需要导入模块: import android [as 别名]
# 或者: from android import AndroidService [as 别名]
def start(self):
self.logging_function(u'??????? ?????? ????', 1, time.time())
self.start_reading_osc_queue()
if platform == 'android':
# self.subprocess = autoclass(
# 'org.fogaprod.vkbot.dev.ServiceBotservice')
# mActivity = autoclass(
# 'org.kivy.android.PythonActivity').mActivity
# argument = ''
# self.subprocess.start(mActivity, argument)
self.subprocess = AndroidService('VKBot', '??? ????????')
self.subprocess.start('?????? ???????')
else:
self.subprocess = subprocess.Popen(
['python2.7', 'service/main.py'])
self.start_requesting_answers_count()
示例3: build
# 需要导入模块: import android [as 别名]
# 或者: from android import AndroidService [as 别名]
def build(self):
if platform == 'android':
from android import AndroidService
service = AndroidService('pupy', 'running')
service.start('service started')
self.service = service
App.get_running_app().stop()
return Builder.load_string(kv)
示例4: start_service
# 需要导入模块: import android [as 别名]
# 或者: from android import AndroidService [as 别名]
def start_service(self, app_name):
if platform == "android" and app_name in self.plugins_list:
# Clean up old logs
self.log_name = os.path.join(
main_utils.get_mobileinsight_analysis_path(),
app_name + "_log.txt")
if os.path.exists(self.log_name):
os.remove(self.log_name)
self.terminal_stop = threading.Event()
self.terminal_thread = threading.Thread(target=self.show_log)
self.terminal_thread.start()
self.error_log = "Running " + app_name + "..."
self.service = AndroidService(
"MobileInsight is running...", app_name)
# stop the running service
self.service.stop()
self.service.start(
app_name + ":" + self.plugins_list[app_name][0]) # app name
self.default_app_name = app_name
# TODO: support collecting TCPDUMP trace
# currentTime = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')
# tcpdumpcmd = "su -c tcpdump -i rmnet_data0 -w " \
# + main_utils.get_mobileinsight_log_path() \
# + "/tcpdump_" + str(currentTime) + ".pcap\n"
# main_utils.run_shell_cmd(tcpdumpcmd)
else:
self.error_log = "Error: " + app_name + "cannot be launched!"
示例5: start_gps_daemon
# 需要导入模块: import android [as 别名]
# 或者: from android import AndroidService [as 别名]
def start_gps_daemon(self):
"""For instance, only Android is supported. An android.app.Service is created.
On iOs, a similar approach may be needed.
"""
if platform == 'android':
from android import AndroidService
service = AndroidService('KivyTrek gps service', 'running')
service.start('service started')
self.service = service
示例6: pong
# 需要导入模块: import android [as 别名]
# 或者: from android import AndroidService [as 别名]
def pong(self, message, *args):
self.logging_function(
u'[b]??? ??? ???????! ??????????????? ?????????[/b]',
2, time.time()
)
self.subprocess = AndroidService('VKBot', '??? ????????')
self.start_requesting_answers_count()
self.mainscreen.ids.main_btn.text = self.mainscreen.stop_bot_text