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


Python AndroidService.start方法代碼示例

本文整理匯總了Python中android.AndroidService.start方法的典型用法代碼示例。如果您正苦於以下問題:Python AndroidService.start方法的具體用法?Python AndroidService.start怎麽用?Python AndroidService.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.AndroidService的用法示例。


在下文中一共展示了AndroidService.start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: start_service

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
	def start_service(self,*args):
		if platform == 'android':
			from android import AndroidService
			service = AndroidService('SRN Service','Generating you great headlines')
			service.start('service started')
			self.service = service
		self.service_enabled = True
開發者ID:Laukei,項目名稱:androidmarkovnews,代碼行數:9,代碼來源:main.py

示例2: build

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
    def build(self):
        if platform ==  "android":
            from android import AndroidService
            service = AndroidService('desire sensors service', 'running')
            service.start('service started')
            self.service = service

        status_page = StatusPage()
        accelerometer.enable()
        compass.enable()
        self.gps = gps
        self.gps.configure(on_location=self.on_gps_location,
                           on_status=self.on_gps_status)
        self.gps.start()

        notification.notify(title="Hello",message="Just Checking")
        #vibrator.vibrate(0.2)  # vibrate for 0.2 seconds
        print("Hello World")
        status_page.gps_data = self.gps_data

#        Clock.schedule_interval(status_page.update, 1.0 / 10.0) # 10H
        Clock.schedule_interval(status_page.update, 1.0) # 1Hz


        button=Button(text='Service',size_hint=(0.12,0.12))
        button.bind(on_press=self.callback)
        status_page.add_widget(button)

        switch = Switch()
        switch.bind(active=self.callback)
        status_page.add_widget(switch)
        return status_page
開發者ID:marcogario,項目名稱:carrasp,代碼行數:34,代碼來源:main.py

示例3: build

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
 def build(self):
     # the root is created in pictures.kv
     self.root
     self.osc_id = osc.listen(ipAddr='0.0.0.0', port=activity_port)
     if platform == 'android':
         from android import AndroidService
         service = AndroidService('Mentor Service', 'running')
         service.start('service started')
         self.service = service
     # get any files into images directory
     curdir = dirname(__file__)
     list = glob(join(curdir, 'images', '*'))
     Logger.debug("{}".format(list))
     shuffle(list)
     Logger.debug("{}".format(list))
     for filename in list:
         try:
             # load the image
             picture = Picture(source=filename, id=filename, rotation=randint(-30, 30))
             # add to the main field
             self.root.add_widget(picture)
         except Exception as e:
             Logger.exception('Pictures: Unable to load <%s>' % filename)
     osc.init()
     self.last_name = ""
     osc.sendMsg('/say', ["La ap di Michele e' pronta", ], port=service_port)
     return self.root
開發者ID:Mau21710,項目名稱:Mentor,代碼行數:29,代碼來源:main.py

示例4: __init__

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
 def __init__(self, platform):
         """
         :param platform: ['android', 'win', 'linux']
         :return:
         """
         self.files = []
         self.titles = []
         self.origins = [os.path.abspath(os.path.join(os.curdir, 'composizioni')),
                         "/sdcard/Mentor",
                         "C:\\Mao\\Progetti\\Mentor\\sequenze"]
         if platform == 'android':
             from android import AndroidService
             service = AndroidService('Mentor Service', 'running')
             service.start('service started')
             self.service = service
             self.folder_music = "/storage/emulated/legacy/Music/PerAttivita"
         elif platform == 'win':
             self.folder_music = "C:\\Mao\\Progetti\\Musica\\MusicaSuNexus\\PerAttivita"
         else:
             self.folder_music = ".\\music"
         Logger.info("Folder music: {}".format(self.folder_music))
         self.base_folder = None # ToDo more General
         for orig in self.origins:
             if os.path.exists(orig):
                 self.base_folder = orig
                 Logger.debug("MentorLib.Sequences.LoadSequence: Set base dir for sequences {}".format(self.base_folder))
                 break
開發者ID:Mau21710,項目名稱:Mentor,代碼行數:29,代碼來源:mentor_lib.py

示例5: build

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
 def build(self):
     config = self.config
     self.icon = 'data/graphics/icons/logo.png'
     self.title = 'onDemand Controller'
     self.weather = Weather_api(key=config.getdefault('hidden',
                                                      'weatherapikey',
                                                      '12345678'))
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     t = s.connect_ex(('127.0.0.1', 4343))
     if t != 0:
         print(platform)
         if platform == 'android':
             from android import AndroidService  # @UnresolvedImport
             service = AndroidService('Controller service', 'running')
             service.start('service started')
             self.service = service
         else:
             import subprocess
             print(os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                'service/main.py'))
             stat = subprocess.Popen(
                 ['/usr/bin/python2',
                  os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               'service/main.py')],
                 close_fds=True)
             print(stat)
     return Main(self)
開發者ID:bverdu,項目名稱:onDemand,代碼行數:29,代碼來源:main.py

示例6: build

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [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:601040605,項目名稱:pupy,代碼行數:10,代碼來源:main.py

示例7: start_service

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
 def start_service(self):
     if _platform == 'android':
         from android import AndroidService
         service = AndroidService('WhiteNoise service', 'running')
         service.start('service started')
         self.service = service
     else:
         pass
開發者ID:rshishkoff,項目名稱:WhiteNoiseMachine,代碼行數:10,代碼來源:whitenoise.py

示例8: build

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
    def build(self):
        global service
        if platform == 'android':
            from android import AndroidService
            service = AndroidService('my service', 'running')
            service.start('service started')

        return NotificationDemo()
開發者ID:KeyWeeUsr,項目名稱:android-notification-buttons,代碼行數:10,代碼來源:main.py

示例9: start_anontunnel_android

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
 def start_anontunnel_android(self):
     """
     Starts the anontunnel as an android service
     """
     from android import AndroidService
     service = AndroidService('Anonymous downloading Service', 'Anonymous tunnels are running...')
     service.start('Anonymous tunnels service started')
     self.service = service
開發者ID:brussee,項目名稱:AT3,代碼行數:10,代碼來源:screens.py

示例10: start_service

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
 def start_service(self):
     if self.service is not None:
         return
     L.info("Trying to start service")
     if platform == 'android':
         from android import AndroidService
         service = AndroidService('AndroidPark(ing)', 'en ejecución...')
         service.start('service started')
         self.service = service
開發者ID:j-santander,項目名稱:androidpark,代碼行數:11,代碼來源:main.py

示例11: start_new_service

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
 def start_new_service(self, title=None, description=None):
     if self.service is not None:
         self.service.stop()
         self.service = None
     service = AndroidService(
       title or self.service_title,
       description or self.service_description)
     service.start('service started')
     self.service = service
開發者ID:sziaru,項目名稱:in-matrix,代碼行數:11,代碼來源:main.py

示例12: UpdaterApp

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
class UpdaterApp(App):
	def build(self):
		print 'start android service'
		from android import AndroidService
		self.service = AndroidService('updater', 'running')
		self.service.start('start')
		
		return UpdaterUI(client=UpdateClient())

	def on_pause(self):
		return True
開發者ID:kived,項目名稱:py4a-updater,代碼行數:13,代碼來源:main.py

示例13: FlashApp

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
class FlashApp(App):
    def build(self):
        self.root = Switch()
        self.service = AndroidService('Kivy FlashLight', 'I haz a FlashLight!')
        self.root.bind(active=self.toggle_flash)
        return self.root

    def toggle_flash(self, *args):
        if self.root.active:
            self.service.start()
        else:
            self.service.stop()
開發者ID:wasit7,項目名稱:tutorials,代碼行數:14,代碼來源:main.py

示例14: RemoteKivyApp

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
class RemoteKivyApp(App):
    def build(self):
        global app
        app = self
        self.service = AndroidService('Kivy Remote Shell',
                                      'remote shell is running')
        self.service.start('8000')
        return MainScreen()

    def quit_app(self):
        self.service.stop()
        self.stop()
開發者ID:b3b,項目名稱:kivy-remote-shell,代碼行數:14,代碼來源:main.py

示例15: DjandroApp

# 需要導入模塊: from android import AndroidService [as 別名]
# 或者: from android.AndroidService import start [as 別名]
class DjandroApp(App):
    def build(self):
        self.service = AndroidService('Django', 'Django is running')
        open(LOGPATH, 'w').close()  # Touch the logfile
        self.running = False
        self.logging = False
        
    def toggle(self):
        action = self.stop if self.running else self.start
        self.running = not self.running
        action()
        self.root.ids['info'].text = "[color=#ff0000]Django is OFF[/color]"
        if self.running:
            self.root.ids['info'].text = "[color=#00ff00]Django is ON[/color]"

        btn_text = 'Stop' if self.running else 'Start'
        self.root.ids['btn'].text = btn_text + " Django"

    def start(self):
        self.service.start(LOGPATH)
        self.start_logging()

    def stop(self):
        self.service.stop()
        self.logging = False
        self.running = False

    def start_logging(self):
        self.console = Thread(target=self.logger)
        self.logging = True
        self.console.start()

    def logger(self):
        label = self.root.ids['console']
        log = open(LOGPATH, 'r')
        label.text = log.read()
        while self.logging:
            log.seek(log.tell())
            label.text += log.read()
            sleep(0.2)

    def on_pause(self):
        if self.logging:
            self.logging = False
            self.console.join()
        return True


    def on_resume(self):
        if self.running:
            self.start_logging()
開發者ID:blagarde,項目名稱:djandro,代碼行數:53,代碼來源:main.py


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