Package: pykivdroid
Pykivdroidpykivdroid is a python module to control androidRequirementskivy,android,pyjniusIntroductionpykivdroid is python module to control Android.
     To test all this things you have to use android device.Classes and mActivity# I have defined java android class# Camera = autoclass('android.hardware.Camera')# And Nested class. N use to indicate nested# CameraNCameraInfo=autoclass('android.hardware.Camera$CameraInfo')# mActivity is App's activityfrompykivdroidimportmActivity,Camera,CameraNCameraInfoOrientationfrompykivdroidimportorientation#To get current orientationa=orientation.get_orientation()print(a)#To set orientation#you can set any mode 'user','portrait','landscape' etcorientation.set_orientation(mode='user')Brightnessfrompykivdroidimportbrightness,write_settings'''Required Permissions:WRITE_SETTINGS'''#To get current brightnessa=brightness.get_brightness()print(a)#To set brightness#minimum brightness is 0, maximum is 100write_settings(sdk_int,version_code)#TO GET PERMISSIONbrightness.set_brightness(50)Speech to textfrompykivdroid.sttimportSTT'''Android Permissions:INTERNET,RECORD_AUDIO'''###you can set language and mode offline or onlinesttobj=STT(language='en-US',prefer_offline=False)#To startsttobj.start()#speech to text exsist or nota=sttobj.exist()print(a)#To stopsttobj.stop()#resultsprint(sttobj.results)#partialprint(sttobj.partial)#errorsprint(sttobj.errors)#listening or notprint(sttobj.listening)#partial resultprint(sttobj.partial_results)File Picker#Android permissions READ_EXTERNAL_STORAGEfrompykivdroid.pickerimportAndroidPickerdefcallback(uri):print(uri)ap=AndroidPicker(callback)ap.pick_file(MIME_type='*/*')####simple examplefromkivy.appimportAppfromkivy.uix.boxlayoutimportBoxLayoutfromkivy.uix.buttonimportButtonfromkivy.uix.textinputimportTextInputfrompykivdroid.pickerimportAndroidPickerfrompykivdroidimportrequest_permissions,PermissionclassMyApp(App):defbuild(self):request_permissions([Permission.READ_EXTERNAL_STORAGE])self.box=BoxLayout(orientation="vertical")self.ap=AndroidPicker(self.call)self.ti=TextInput()self.box.add_widget(Button(text='OPEN AndroidPicker',on_release=self.callback))self.box.add_widget(self.ti)returnself.boxdefcallback(self,obj):self.ap.pick_file()defcall(self,uri):print(uri)self.ti.text=str(uri)MyApp().run()Android Video Viewfrompykivdroid.videoviewimportAndroidVideoViewvideoview=AndroidVideoView()videoview.set_video_uri(uri)#orvideoview.set_video_path(path)#to startvideoview.start()#to seek any positionvideoview.seek_to(ms)#to stopvideoview.stop_playback()#pausevideoview.pause()#resumevideoview.resume()#get durationvideoview.get_duration()#get current positionvideoview.get_current_position()#to get audio session idvideoview.get_audio_session_id()#playing or notprint(videoview.is_playing())######for more info. read videoview.py in pykivdroid#simple example with kivyfromkivy.appimportAppfromkivy.uix.boxlayoutimportBoxLayoutfromkivy.uix.buttonimportButtonfromkivy.uix.textinputimportTextInputfrompykivdroid.pickerimportAndroidPickerfrompykivdroidimportrequest_permissions,Permissionfrompykivdroid.videoviewimportAndroidVideoViewclassMyApp(App):defbuild(self):request_permissions([Permission.READ_EXTERNAL_STORAGE])self.box=BoxLayout(orientation="vertical")self.ap=AndroidPicker(self.call)self.vv=AndroidVideoView()self.box.add_widget(self.vv)self.box.add_widget(Button(text='choose video',on_release=self.callback))returnself.boxdefcallback(self,obj):self.ap.pick_file()defcall(self,uri):print(uri)self.vv.set_video_uri(uri)self.vv.start()MyApp().run()Text To Speech#permission INTERNETfrompykivdroid.ttsimportTTStts=TTS()tts.speak('text to speak')##see also and for more info see tts.py in pykivdroid.tts.get_voices()tts.get_language()tts.get_engines()tts.get_duration()tts.get_available_languages()tts.get_default_voice()tts.get_max_input_length()tts.get_default_engine()tts.set_voice(voice)tts.set_pitch(pitch)tts.set_language(loc)tts.set_speech_rate(rate)tts.is_speaking()tts.is_language_available(loc)#example with kivy#permission INTERNETfromkivy.appimportAppfromkivy.uix.boxlayoutimportBoxLayoutfromkivy.uix.buttonimportButtonfromkivy.uix.textinputimportTextInputfromkivy.uix.sliderimportSliderfrompykivdroid.ttsimportTTSfrompykivdroidimportArrayList,ArraysclassMyApp(App):text='Python is good programming language'i=0defbuild(self):self.box=BoxLayout(orientation="vertical")self.ti=TextInput(text=self.text)#slider used to change pitchself.sldr=Slider(min=0,max=1,value=0.5)#slider used to change speech rateself.sldr2=Slider(min=0,max=1,value=0.5)#1)tts objectself.tts=TTS()#self.voice=self.tts.get_voices()self.box.add_widget(self.ti)self.box.add_widget(self.sldr)self.box.add_widget(self.sldr2)self.box.add_widget(Button(text='speak',on_release=self.callback))returnself.boxdefcallback(self,obj):#changing voicevoice=self.tts.get_voices()ifself.i==len(voice):self.i=0self.tts.set_voice(voice[self.i])self.tts.set_pitch(self.sldr.value)self.tts.set_speech_rate(self.sldr2.value)self.tts.speak(self.ti.text)#print(self.tts.get_voices())self.i+=1MyApp().run()Unity Ads1)Download Unity-ads.aar from unity ads 

2)Create libs folder within your project folder

3)Add Unity-ads.aar to your /libs folder

4)update buildozer.spec 

android.add_aars = ./libs/*.aar
android permissions = INTERNET,ACCESS_NETWORK_STATEUnity Interstitial and Reward ads'''1)Download Unity-ads.aar from unity ads2)Add Unity-ads.aar to your /libs folderupdate buildozer.specandroid.add_aars = ./libs/*.aarandroid permissions = INTERNET,ACCESS_NETWORK_STATE'''fromkivy.appimportAppfromkivy.uix.buttonimportButtonfromkivy.uix.boxlayoutimportBoxLayoutfrompykivdroid.unityadsimportUnityHandlerclassMyApp(App):defbuild(self):self.box=BoxLayout(orientation='vertical')#1 stepself.uh=UnityHandler(app_id='put app id here',)#2 set ads_type="reward" or "interstitial",test_mode=True or False,callback is used for Reward ads status for interstitial put callback=Noneself.uh.init_ads(ads_type="reward",test_mode=True,callback=self.call_status)self.box.add_widget(Button(text='show reward ads',on_release=self.call))returnself.boxdefcall(self,obj):self.uh.show_ads('put ads id here')defcall_status(self,status):print("reward : ",status)MyApp().run()Unity Banner adsI have implemented unity banner ads but test mode is only working in IndiaBanner ads issue#simple examplefromkivy.appimportAppfromkivy.uix.buttonimportButtonfromkivy.uix.boxlayoutimportBoxLayoutfrompykivdroid.unityadsimportUnityHandlerclassMyApp(App):defbuild(self):self.box=BoxLayout(orientation='vertical')self.uh=UnityHandler(app_id='put app id ',)#self.uh.init_ads(ads_type="reward",test_mode=False,callback=self.callback)self.uh.init_banner_ads('put ads id',test_mode=True,top_pos=True)self.uh.load_banner()self.box.add_widget(Button(text='show banner ads',on_release=self.call))self.box.add_widget(Button(text='hide banner ads  ',on_release=self.call2))returnself.boxdefcall2(self,obj):self.uh.hide_banner()defcall(self,obj):self.uh.show_banner()self.uh.load_banner()#self.uh.show_ads()defcallback(self,*a):print("hello",a)MyApp().run()