kivy on android and google maps V2

799 views
Skip to first unread message

maxT

unread,
Jul 18, 2013, 11:05:55 AM7/18/13
to kivy-...@googlegroups.com
Hi,

and thank you a lot for Kivy, it's superb and developing very well. I've almost decided to kick android SDK and shift my app development to Kivy + python for android, it took me a couple of days (from zero knowledge) to develop the GUI structure of my app, while with the SDK it took me around 3 weeks (equally from zero knowledge) and also because I love python while java hates me :-) 

I've said *almost*, because I still miss one key capability, which is integration with map APIs, I can't do without it.

I did my search on google, this group and also S.O. but couldn't find any trace of map integration, except for kivymaps, which doesn't make use of google APIs.

I'm aware that pyjnius let me call java classes from android apis, however I don't have a clue how to make use of maps V2 classes... you have to instantiate a mapfragment, or a mpaview, first and that's the only way you can display and programmatically interact with a googlemap.

So I'm puzzled... is it possible to wrap an android view (or fragment) in a Kivy custom widget ? if so, would you be so kind to give me a kickstart to the right direction or to the relevant doc or code I may have missed ? otherwise, if you confirm that this is simply not possible at this stage I will not waste anymore time on porting this app on kivy and focus on the others in pipeline :-)

thank you in advance
maxT

Mathieu Virbel

unread,
Aug 3, 2013, 6:39:05 PM8/3/13
to kivy-...@googlegroups.com
Hi Maxt,

Sorry for the delay, nobody answered because nobody got it working. Me
neither... yet. Pyjnius and python-for-android got better every
iteration, and i've tested this week if it would be possible to add
"android" widget/view in top of the SDLSurfaceView. The answer is... yes.

Have a look at my tests:

https://gist.github.com/tito/6118172

It doesn't look pretty, but that was just a test.

Notes:
- Any changes to the Activity content view must be done in a Runnable.
In my example, i use Runnable(func)(...). You can just use
Runnable(func)() no need to args/kwargs anymore.
- Use addContentView, not setContentView, or the app will crash. Nasty
bug, dunno why, but that's it.
- Update your python-for-android copy (or reclone it), i've fixed issues
this week about it.
- => You can add/remove android widget. I'm currently testing the
integration of Facebook SDK to Kivy android app, so if anything wrong
appear, i'll fix it.


My feeling is, because android widget will be always sort-of overlay, i
wonder if we can correctly control the position and have sort-of mask.
If our view is always axis-aligned (ie, not i a scatter), then maybe we
could have sort-of auto pos/size from kivy to android widget.

Anyway, good luck!

Mathieu


Le 18/07/2013 17:05, maxT a �crit :
> --
> You received this message because you are subscribed to the Google
> Groups "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to kivy-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

maxT

unread,
Aug 12, 2013, 9:31:13 AM8/12/13
to kivy-...@googlegroups.com
Hi Mathieu

thanks for the reply and for the example. I'll give it a try with the maps api. If I'll make it I'll turn it into a widget for the garden.

I just hope I haven't stretched my ambitions too much compared to my abilities :-)

best regards
MaxT
Reply all
Reply to author
Forward
0 new messages