當前位置: 首頁>>代碼示例>>Python>>正文


Python android.AndroidService方法代碼示例

本文整理匯總了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 
開發者ID:Bakterija,項目名稱:android-notification-buttons,代碼行數:27,代碼來源:main.py

示例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() 
開發者ID:Fogapod,項目名稱:VKBot,代碼行數:20,代碼來源:oscclient.py

示例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) 
開發者ID:xSploited,項目名稱:OSPTF,代碼行數:10,代碼來源:main.py

示例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!" 
開發者ID:mobile-insight,項目名稱:mobileinsight-mobile,代碼行數:35,代碼來源:home.py

示例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 
開發者ID:peterLaurence,項目名稱:KivyTrek,代碼行數:11,代碼來源:gps.py

示例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 
開發者ID:Fogapod,項目名稱:VKBot,代碼行數:10,代碼來源:oscclient.py


注:本文中的android.AndroidService方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。