control interface android ?

All things Storyboard for the Android platform.

Moderator: jamiev

control interface android ?

Postby mohammed foud » Sun Jul 29, 2018 1:11 pm

How can i deal with wifi and bluetooh via Storyboard ?
are you example for control wifi and gps and other ?
mohammed foud
 
Posts: 15
Joined: Fri May 25, 2018 4:13 pm

Re: control interface android ?

Postby garry » Mon Jul 30, 2018 3:56 am

Hi Mohammed,

on the Android platform Storyboard runs as a separate 'front-end' process which handles touch and graphics. To access other resources such as network access, WiFi, Bluetooth and GPS you will need the access for and permissions to make use of those Android APIs. This is typically done using Lua script or C/C++ which is your custom 'back-end' process for your application.

The forum link below shows how you can do this for network access on Android using C:
http://forums.cranksoftware.com/viewtopic.php?f=9&t=621

This forum thread also discussed using the Storyboard IO library with Android:
http://forums.cranksoftware.com/viewtopic.php?f=9&t=386

Hopefully this helps.

Garry
garry
 
Posts: 7
Joined: Wed Jan 31, 2018 5:22 am
Location: Bath, UK

Re: control interface android ?

Postby mlove » Mon Jul 30, 2018 4:40 am

Hi Mohammed,

I want to make a correction to Garry's post. Normally on most embedded systems we would run separate front-end and back-end processes that would communicate with each other over SBIO. However on most commercial Android devices it isn't possible to run a back-end process, and for what you are looking to do this isn't necessary. The standard Android Java SDK provides access to both the wifi and gps information, via the WifiManager and LocationManager respectively. And it's possible to access the SDK Java classes via the LuaJava interface we've built into our Lua library (only available on the Android runtime). Here's our documentation on LuaJava: https://cranksoftware.com/cranksoftware ... 1793854512.

I'm also including a quick example of how to use LuaJava with the LocationManager to access the gps location. It doesn't do much beyond dumping the location to a variable in the model that could be use to display to the user, but it will show how to access the LocationManager and how to create a proxy that could be used to register for location updates. To use the LocationManager you'll need to set the ACCESS_FINE_LOCATION permission in the manifest file.

Matt
Attachments
gps.lua
Android GPS LuaJava Example
(3.05 KiB) Downloaded 89 times
mlove
 
Posts: 24
Joined: Tue Apr 17, 2012 1:26 pm

Re: control interface android ?

Postby mohammed foud » Mon Jul 30, 2018 6:43 am

Thank you, for your reply and examples.
And follow-up to the subject ..
Thanks again
mohammed foud
 
Posts: 15
Joined: Fri May 25, 2018 4:13 pm

Re: control interface android ?

Postby mohammed foud » Mon Jul 30, 2018 8:14 am

How can I include the file attached to the project ??

mlove wrote:Hi Mohammed,

I want to make a correction to Garry's post. Normally on most embedded systems we would run separate front-end and back-end processes that would communicate with each other over SBIO. However on most commercial Android devices it isn't possible to run a back-end process, and for what you are looking to do this isn't necessary. The standard Android Java SDK provides access to both the wifi and gps information, via the WifiManager and LocationManager respectively. And it's possible to access the SDK Java classes via the LuaJava interface we've built into our Lua library (only available on the Android runtime). Here's our documentation on LuaJava: https://cranksoftware.com/cranksoftware ... 1793854512.

I'm also including a quick example of how to use LuaJava with the LocationManager to access the gps location. It doesn't do much beyond dumping the location to a variable in the model that could be use to display to the user, but it will show how to access the LocationManager and how to create a proxy that could be used to register for location updates. To use the LocationManager you'll need to set the ACCESS_FINE_LOCATION permission in the manifest file.

Matt
mohammed foud
 
Posts: 15
Joined: Fri May 25, 2018 4:13 pm

Re: control interface android ?

Postby mlove » Mon Jul 30, 2018 8:30 am

mohammed foud wrote:How can I include the file attached to the project ??


It's a lua file, it belongs in the scripts directory. Keep in mind it doesn't do much, it's simply an example. But it should give you an idea of how to work with the WifiManager and LocationManager. I'd also refer to Google's docs on those classes.
mlove
 
Posts: 24
Joined: Tue Apr 17, 2012 1:26 pm

Re: control interface android ?

Postby mohammed foud » Mon Jul 30, 2018 2:56 pm

ok

mlove wrote:
mohammed foud wrote:How can I include the file attached to the project ??


It's a lua file, it belongs in the scripts directory. Keep in mind it doesn't do much, it's simply an example. But it should give you an idea of how to work with the WifiManager and LocationManager. I'd also refer to Google's docs on those classes.
mohammed foud
 
Posts: 15
Joined: Fri May 25, 2018 4:13 pm


Return to Storyboard for Android

Who is online

Users browsing this forum: No registered users and 1 guest

cron