Internet connection in app inventor

1,197 views
Skip to first unread message

Piniu

unread,
Jul 18, 2019, 3:24:48 AM7/18/19
to mitappinv...@googlegroups.com
Hi all. I have a question. Do you now how enable internet connection in app inventor? It's possible?
I have a lot of mobiles in my fleet which are blocked to drivers can't change settings etc.
Sometimes I have to force the inclusion of the internet so I would like to do it in the application.
The Bluetooth connection was possible (tap button and action) but I did not find the internet transfer.


InkedApp Inventor_LI.jpg



WhatsApp Image 2019-07-17 at 16.02.53.jpeg
WhatsApp Image 2019-07-17 at 16.03.16.jpeg

Chris Ward

unread,
Jul 18, 2019, 7:16:02 AM7/18/19
to MIT App Inventor Forum
Hi Piniu

Your Bluetooth Blocks are not OK - it is never OK to leave open "jigsaw" pieces.

For the internet, you would need to switch on the phone's WiFi. I would hope that would be possible via Activity Starter too, but I have not found any reference as to how exactly

Do I see an extension in your Blocks for internet connections? If so, does the developer not give example code?

How to switch the Phone's Bluetooth on:

SwitchOnBluetooth.png



Chris Ward

unread,
Jul 18, 2019, 7:27:48 AM7/18/19
to MIT App Inventor Forum
Hi again Piniu

I think Taifun's WiFi extension is what you need:


Piniu

unread,
Jul 18, 2019, 7:51:56 AM7/18/19
to mitappinv...@googlegroups.com
I know, but I need for data transfer - not wifi.

InkedWhatsApp Image 2019-07-18 at 13.54.27_LI.jpg


Chris Ward

unread,
Jul 18, 2019, 8:37:11 AM7/18/19
to MIT App Inventor Forum
Hi Piniu

So how are you going to enable the transfer of data?

Connection
A wired connection to a broadband modem?
WiFi?
Using the phones' data allocation?

Data transfer method
HTTP GET/POST?
FTP?
Message has been deleted

Piniu

unread,
Jul 18, 2019, 8:47:52 AM7/18/19
to MIT App Inventor Forum
No, no, you run too far. I only need to turn on the internet connection, but not wifi. I have stupid drivers who really do not know where to turn it on and that's why I make them a button in the app to see. Check out my app screenshots in the first post. A simple thing. Maybe someone will write some extension to this?

Chris Ward

unread,
Jul 18, 2019, 8:53:51 AM7/18/19
to MIT App Inventor Forum
Piniu

Please answer my questions in my previous post.

Piniu

unread,
Jul 18, 2019, 8:55:31 AM7/18/19
to MIT App Inventor Forum
W dniu czwartek, 18 lipca 2019 13:16:02 UTC+2 użytkownik Chris Ward napisał:
Hi Piniu


Do I see an extension in your Blocks for internet connections? If so, does the developer not give example code?


I don't now. I was looking for an extension where I could but I did not find it. I wrote to Taifun and he directed me here.

Chris Ward

unread,
Jul 18, 2019, 8:58:33 AM7/18/19
to MIT App Inventor Forum

Piniu

unread,
Jul 18, 2019, 9:19:11 AM7/18/19
to MIT App Inventor Forum
I wrote at 14:47 (look up_ :)

"No, no, you run too far. I only need to turn on the internet connection, but not wifi. My app need internet connection but
otherwise it does not work.  I have stupid drivers who really do not know where to turn it on and that's why I make them a button in the app to see.

Chris Ward

unread,
Jul 18, 2019, 10:02:20 AM7/18/19
to MIT App Inventor Forum
Hi Piniu

I can't help you - I think you mean the method of connection will be via the phone's mobile network data allocation but not all phone Users have data included in the deal with their supplier, some only have calls, messages and WiFi. 

The principle behind getting help from us on this forum is to help us to help you by answering our questions properly. If you are not willing to do that, how can anyone help you?

https://www.professorcad.co.uk/appinventortips#TipsForum   Getting Help on the App Inventor Forum


Piniu

unread,
Jul 18, 2019, 10:20:04 AM7/18/19
to MIT App Inventor Forum

 I think you mean the method of connection will be via the phone's mobile network data allocation

Yes! Exactly, I just did not know how to name it in English, let you know what's going on.
I am not interested in other users, the application is for us and I need this option :)
There must be a way to enable it through APP INVENTOR

Taifun

unread,
Jul 18, 2019, 12:08:33 PM7/18/19
to MIT App Inventor Forum
try this to open the settings for your users, so they can enable mobile data there...

Unbenannt.JPG


Taifun


Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Piniu

unread,
Jul 19, 2019, 1:48:11 AM7/19/19
to mitappinv...@googlegroups.com
Thx Taifun. This is one idea :) But I would prefer it to be turned on immediately and I will look for it further :)

Piniu

unread,
Jul 19, 2019, 2:31:43 AM7/19/19
to mitappinv...@googlegroups.com
android.settings.DATA_USAGE_SETTINGS   is not working :(
but works android.settings.DATA_ROAMING_SETTINGS ;)

Piniu

unread,
Jul 19, 2019, 2:58:57 AM7/19/19
to MIT App Inventor Forum

Chris Ward

unread,
Jul 19, 2019, 8:02:54 AM7/19/19
to MIT App Inventor Forum
Hi Piniu

Given that turning on Data without the User controlling the action could be malicious, I think Android will not allow it.

What you need to do is pop-up a Notification "Please switch on network DATA" and when the User taps "OK", run the Activity Starter to take the User to the Data Setting, ready for him/her to toggle the switch.
Message has been deleted
Message has been deleted
Message has been deleted

Piniu

unread,
Jul 19, 2019, 8:20:08 AM7/19/19
to mitappinv...@googlegroups.com
I have it ;) In attachment ready application
DonTruckingConnect.aia
Message has been deleted

Chris Ward

unread,
Jul 19, 2019, 4:29:20 PM7/19/19
to mitappinv...@googlegroups.com
Hi Piniu

Well that is great news, you have done well to persevere and get there :)

Your code has a lot of flaws though, starting with the clock timer which is gong to flash the settings page up every 2 seconds!  You do not need a clock timer at all. You do need to tell the User what is going on if there is an error or they chose not to make one of the connections. You can't use the same Activity Starter for two Activities since the User might press the buttons in quick succession - which would cause a crash. Didn't I say you should never leave open jigsaw puzzles? :)

Why on earth are the two buttons in a Table Arrangement, and that TA in a Vertical Scroll Arrangement?  Scrap that and put the buttons in a Horizontal Arrangement - use an empty label in between the buttons as a spacer, height and width = fill parent. 

So, Blocks like this:

CheckForBtAndMobNet.png



DonTruckingConnect_Mod.aia

Piniu

unread,
Jul 22, 2019, 5:04:58 AM7/22/19
to MIT App Inventor Forum
Thank's Chris. Next time I'll remember your Tips.


Why on earth are the two buttons in a Table Arrangement, and that TA in a Vertical Scroll Arrangement?


Because I used the template of another application so quickly delete what is unnecessary :)
Reply all
Reply to author
Forward
0 new messages