当前位置: 首页>>代码示例>>Python>>正文


Python android.AndroidService类代码示例

本文整理汇总了Python中android.AndroidService的典型用法代码示例。如果您正苦于以下问题:Python AndroidService类的具体用法?Python AndroidService怎么用?Python AndroidService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AndroidService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build

    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,代码行数:32,代码来源:main.py

示例2: __init__

 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,代码行数:27,代码来源:mentor_lib.py

示例3: build

 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,代码行数:27,代码来源:main.py

示例4: start_service

	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,代码行数:7,代码来源:main.py

示例5: build

 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,代码行数:27,代码来源:main.py

示例6: start_service

 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,代码行数:8,代码来源:whitenoise.py

示例7: build

    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,代码行数:8,代码来源:main.py

示例8: start_anontunnel_android

 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,代码行数:8,代码来源:screens.py

示例9: build

	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,代码行数:8,代码来源:main.py

示例10: start_service

 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,代码行数:9,代码来源:main.py

示例11: start_new_service

 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,代码行数:9,代码来源:main.py

示例12: UpdaterApp

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,代码行数:11,代码来源:main.py

示例13: RemoteKivyApp

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,代码行数:12,代码来源:main.py

示例14: FlashApp

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,代码行数:12,代码来源:main.py

示例15: DjandroApp

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,代码行数:51,代码来源:main.py


注:本文中的android.AndroidService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。