Connect to a wifi network

Cranx

Member
Licensed User
Longtime User
Hi all,

I must firstly say that B4A is brilliant and so satisfying to learn! :sign0098:

Can anyone guide me to solve my next challenge in my app design please:

Is there a way to:

  • find a wifi network
  • enter WPA security code
  • Connect

All within my app using b4a? (i.e. not using the networks settings on the phone)

I'd like to do it within my app please

Please help, it will be very much appreciated.
 

Cranx

Member
Licensed User
Longtime User
Hey Erel,

Done some working around and investigating and found:

Sub wifi_btn_click
Dim i As Intent
i.Initialize( "android.settings.WIFI_SETTINGS", "")
i.Flags = 268435456
StartActivity(i)

End Sub


Works perfectly

Hope it helps anyone that wants this function, thanks Erel, your the best, support here is great and very prompt!
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
Useful info:


Constant Value: 268435456 (0x10000000)


public static final int FLAG_ACTIVITY_NEW_TASK

Since: API Level 1
If set, this activity will become the start of a new task on this history stack. A task (from the activity that started it to the next task activity) defines an atomic group of activities that the user can move to. Tasks can be moved to the foreground and background; all of the activities inside of a particular task always remain in the same order. See Tasks and Back Stack for more information about tasks.
This flag is generally used by activities that want to present a "launcher" style behavior: they give the user a list of separate things that can be done, which otherwise run completely independently of the activity launching them.
When using this flag, if a task is already running for the activity you are now starting, then a new activity will not be started; instead, the current task will simply be brought to the front of the screen with the state it was last in. See FLAG_ACTIVITY_MULTIPLE_TASK for a flag to disable this behavior.
This flag can not be used when the caller is requesting a result from the activity being launched.
 
Upvote 0
Top