kivy + android intent filters
up vote
1
down vote
favorite
Im very new to kivy and python so I may have thrown myself in at the deep end here but i'm trying to figure out how to get an android intent and use it within a simple kivy app?
So im currently trying to figure out the basic design elements and just how to get stuff working. I want to be able to click on a link (for example) and launch my app and then do stuff, nothing too complicated, it just needs to be able to get the link which is passed to it from android.
I figured out this was to do with android intent filters and added the appropriate "intent_filters.xml" file to make this work.
So clicking on the link will launch my app, which is good.
However I cant figure out then how to parse the information passed to the app in android. So below is a very simple app with a button and I just want to update the button to see if my intent is being picked up or not.
Currently clicking the button causes the app to close. When i test this in the Kivy VM I am using to compile the apk it will close with a message that "platform" is not defined (which makes sense as its not in android) but it doesnt much help with testing or tracking down how to make it work.
I've read some stuff which seems to suggest that this might not be possible with kivy?
Can anyone confirm if this is possible in kivy and if so, how?
(i've tried variations on activity.getIntent(), intent.getData(), Intent.getIntent().getStringExtra(Intent.EXTRA_TEXT), Intent().getData().getPath() all to no avail)
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
class TutorialApp(App):
def build(self):
self.gen_btn = Button(text='Initial',
size_hint=(.90, .10),
pos=(5, 5),
font_size=50)
self.gen_btn.bind(on_press=self.update_tutorialapp)
l = BoxLayout()
l.add_widget(self.gen_btn)
return l
def update_tutorialapp(self, *args):
st = update_button()
st.update_Message(self)
class update_button():
def update_Message(self, source):
source.gen_btn.text = "the event was called"
if platform=="android":
from jnius import cast
from jnius import autoclass
import android
import android.activity
# test for an intent passed to us
PythonActivity = autoclass('org.renpy.android.PythonActivity')
activity = PythonActivity.mActivity
intent = activity.getIntent()
intent_data = intent.getData()
source.gen_btn.text = PythonActivity.getIntent().getStringExtra(Intent.EXTRA_TEXT)
if __name__ == "__main__":
TutorialApp().run()
android python-2.7 kivy
add a comment |
up vote
1
down vote
favorite
Im very new to kivy and python so I may have thrown myself in at the deep end here but i'm trying to figure out how to get an android intent and use it within a simple kivy app?
So im currently trying to figure out the basic design elements and just how to get stuff working. I want to be able to click on a link (for example) and launch my app and then do stuff, nothing too complicated, it just needs to be able to get the link which is passed to it from android.
I figured out this was to do with android intent filters and added the appropriate "intent_filters.xml" file to make this work.
So clicking on the link will launch my app, which is good.
However I cant figure out then how to parse the information passed to the app in android. So below is a very simple app with a button and I just want to update the button to see if my intent is being picked up or not.
Currently clicking the button causes the app to close. When i test this in the Kivy VM I am using to compile the apk it will close with a message that "platform" is not defined (which makes sense as its not in android) but it doesnt much help with testing or tracking down how to make it work.
I've read some stuff which seems to suggest that this might not be possible with kivy?
Can anyone confirm if this is possible in kivy and if so, how?
(i've tried variations on activity.getIntent(), intent.getData(), Intent.getIntent().getStringExtra(Intent.EXTRA_TEXT), Intent().getData().getPath() all to no avail)
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
class TutorialApp(App):
def build(self):
self.gen_btn = Button(text='Initial',
size_hint=(.90, .10),
pos=(5, 5),
font_size=50)
self.gen_btn.bind(on_press=self.update_tutorialapp)
l = BoxLayout()
l.add_widget(self.gen_btn)
return l
def update_tutorialapp(self, *args):
st = update_button()
st.update_Message(self)
class update_button():
def update_Message(self, source):
source.gen_btn.text = "the event was called"
if platform=="android":
from jnius import cast
from jnius import autoclass
import android
import android.activity
# test for an intent passed to us
PythonActivity = autoclass('org.renpy.android.PythonActivity')
activity = PythonActivity.mActivity
intent = activity.getIntent()
intent_data = intent.getData()
source.gen_btn.text = PythonActivity.getIntent().getStringExtra(Intent.EXTRA_TEXT)
if __name__ == "__main__":
TutorialApp().run()
android python-2.7 kivy
Hi, if your app crash, then please report the log associated to the crash. What does it tells you?
– tito
Nov 12 at 12:40
Well the only way I have to run it on Android currently is to copy it to my phone so I don't really get any messages when it crashes. If I enable logging/debugging when I create the APK would I be able to retrieve any useful information from a non rooted android phone (ie from the apps install directory within android)?
– Philip Shaw
Nov 14 at 17:49
Use android tool: adb logcat
– tito
Nov 14 at 19:16
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Im very new to kivy and python so I may have thrown myself in at the deep end here but i'm trying to figure out how to get an android intent and use it within a simple kivy app?
So im currently trying to figure out the basic design elements and just how to get stuff working. I want to be able to click on a link (for example) and launch my app and then do stuff, nothing too complicated, it just needs to be able to get the link which is passed to it from android.
I figured out this was to do with android intent filters and added the appropriate "intent_filters.xml" file to make this work.
So clicking on the link will launch my app, which is good.
However I cant figure out then how to parse the information passed to the app in android. So below is a very simple app with a button and I just want to update the button to see if my intent is being picked up or not.
Currently clicking the button causes the app to close. When i test this in the Kivy VM I am using to compile the apk it will close with a message that "platform" is not defined (which makes sense as its not in android) but it doesnt much help with testing or tracking down how to make it work.
I've read some stuff which seems to suggest that this might not be possible with kivy?
Can anyone confirm if this is possible in kivy and if so, how?
(i've tried variations on activity.getIntent(), intent.getData(), Intent.getIntent().getStringExtra(Intent.EXTRA_TEXT), Intent().getData().getPath() all to no avail)
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
class TutorialApp(App):
def build(self):
self.gen_btn = Button(text='Initial',
size_hint=(.90, .10),
pos=(5, 5),
font_size=50)
self.gen_btn.bind(on_press=self.update_tutorialapp)
l = BoxLayout()
l.add_widget(self.gen_btn)
return l
def update_tutorialapp(self, *args):
st = update_button()
st.update_Message(self)
class update_button():
def update_Message(self, source):
source.gen_btn.text = "the event was called"
if platform=="android":
from jnius import cast
from jnius import autoclass
import android
import android.activity
# test for an intent passed to us
PythonActivity = autoclass('org.renpy.android.PythonActivity')
activity = PythonActivity.mActivity
intent = activity.getIntent()
intent_data = intent.getData()
source.gen_btn.text = PythonActivity.getIntent().getStringExtra(Intent.EXTRA_TEXT)
if __name__ == "__main__":
TutorialApp().run()
android python-2.7 kivy
Im very new to kivy and python so I may have thrown myself in at the deep end here but i'm trying to figure out how to get an android intent and use it within a simple kivy app?
So im currently trying to figure out the basic design elements and just how to get stuff working. I want to be able to click on a link (for example) and launch my app and then do stuff, nothing too complicated, it just needs to be able to get the link which is passed to it from android.
I figured out this was to do with android intent filters and added the appropriate "intent_filters.xml" file to make this work.
So clicking on the link will launch my app, which is good.
However I cant figure out then how to parse the information passed to the app in android. So below is a very simple app with a button and I just want to update the button to see if my intent is being picked up or not.
Currently clicking the button causes the app to close. When i test this in the Kivy VM I am using to compile the apk it will close with a message that "platform" is not defined (which makes sense as its not in android) but it doesnt much help with testing or tracking down how to make it work.
I've read some stuff which seems to suggest that this might not be possible with kivy?
Can anyone confirm if this is possible in kivy and if so, how?
(i've tried variations on activity.getIntent(), intent.getData(), Intent.getIntent().getStringExtra(Intent.EXTRA_TEXT), Intent().getData().getPath() all to no avail)
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
class TutorialApp(App):
def build(self):
self.gen_btn = Button(text='Initial',
size_hint=(.90, .10),
pos=(5, 5),
font_size=50)
self.gen_btn.bind(on_press=self.update_tutorialapp)
l = BoxLayout()
l.add_widget(self.gen_btn)
return l
def update_tutorialapp(self, *args):
st = update_button()
st.update_Message(self)
class update_button():
def update_Message(self, source):
source.gen_btn.text = "the event was called"
if platform=="android":
from jnius import cast
from jnius import autoclass
import android
import android.activity
# test for an intent passed to us
PythonActivity = autoclass('org.renpy.android.PythonActivity')
activity = PythonActivity.mActivity
intent = activity.getIntent()
intent_data = intent.getData()
source.gen_btn.text = PythonActivity.getIntent().getStringExtra(Intent.EXTRA_TEXT)
if __name__ == "__main__":
TutorialApp().run()
android python-2.7 kivy
android python-2.7 kivy
asked Nov 11 at 14:13
Philip Shaw
62
62
Hi, if your app crash, then please report the log associated to the crash. What does it tells you?
– tito
Nov 12 at 12:40
Well the only way I have to run it on Android currently is to copy it to my phone so I don't really get any messages when it crashes. If I enable logging/debugging when I create the APK would I be able to retrieve any useful information from a non rooted android phone (ie from the apps install directory within android)?
– Philip Shaw
Nov 14 at 17:49
Use android tool: adb logcat
– tito
Nov 14 at 19:16
add a comment |
Hi, if your app crash, then please report the log associated to the crash. What does it tells you?
– tito
Nov 12 at 12:40
Well the only way I have to run it on Android currently is to copy it to my phone so I don't really get any messages when it crashes. If I enable logging/debugging when I create the APK would I be able to retrieve any useful information from a non rooted android phone (ie from the apps install directory within android)?
– Philip Shaw
Nov 14 at 17:49
Use android tool: adb logcat
– tito
Nov 14 at 19:16
Hi, if your app crash, then please report the log associated to the crash. What does it tells you?
– tito
Nov 12 at 12:40
Hi, if your app crash, then please report the log associated to the crash. What does it tells you?
– tito
Nov 12 at 12:40
Well the only way I have to run it on Android currently is to copy it to my phone so I don't really get any messages when it crashes. If I enable logging/debugging when I create the APK would I be able to retrieve any useful information from a non rooted android phone (ie from the apps install directory within android)?
– Philip Shaw
Nov 14 at 17:49
Well the only way I have to run it on Android currently is to copy it to my phone so I don't really get any messages when it crashes. If I enable logging/debugging when I create the APK would I be able to retrieve any useful information from a non rooted android phone (ie from the apps install directory within android)?
– Philip Shaw
Nov 14 at 17:49
Use android tool: adb logcat
– tito
Nov 14 at 19:16
Use android tool: adb logcat
– tito
Nov 14 at 19:16
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249584%2fkivy-android-intent-filters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hi, if your app crash, then please report the log associated to the crash. What does it tells you?
– tito
Nov 12 at 12:40
Well the only way I have to run it on Android currently is to copy it to my phone so I don't really get any messages when it crashes. If I enable logging/debugging when I create the APK would I be able to retrieve any useful information from a non rooted android phone (ie from the apps install directory within android)?
– Philip Shaw
Nov 14 at 17:49
Use android tool: adb logcat
– tito
Nov 14 at 19:16