Enviar mensajes sms en kivy en android es muy sencillo, basta con checa un poco de pyler y ya está. No obstante leer es una historia muy diferente, a continuación te coloco un código sencillo para leer sms.
#-*- coding: utf-8 -*-
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.utils import platform
class Principal(App):
def prueba(self,ins):
if platform == 'android':
from jnius import autoclass
from jnius import cast
from android import activity
# change if trouble with sdl or pygame
#PythonActivity = autoclass('org.kivy.android.PythonActivity')
PythonActivity = autoclass('org.renpy.android.PythonActivity')
Intent = autoclass('android.content.Intent')
Uri = autoclass('android.net.Uri')
Cursor = autoclass('android.database.Cursor')
currentActivity = cast('android.app.Activity', PythonActivity.mActivity)
uriSms = Uri.parse('content://sms')
cursor = currentActivity.getContentResolver().query(uriSms,[
'_id', 'address', 'body', 'type', 'read'],
"type=1", None,
"date COLLATE LOCALIZED ASC limit 10")
if cursor and cursor.getCount():
cursor.moveToFirst()
print(cursor.getString(cursor.getColumnIndex('_id')))
print(cursor.getString(cursor.getColumnIndex('body')))
cursor.close()
def build(self):
L = BoxLayout(orientation='vertical',padding=[30,30,30,0], spacing = [4,4])
btninfo = Button(
text='Arriba', size_hint=(0.5, None),
background_color = kivy.utils.get_color_from_hex('300076'),
background_normal=''
)
L.add_widget(btninfo)
btninfo.bind(on_press=self.prueba)
return L
if __name__ == '__main__':
Principal().run()
Congratulations @eolandro! You received a personal award!
Click here to view your Board
Do not miss the last post from @steemitboard:
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @eolandro! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit