7

I have custom hardware and custom android operating system. Devices are unable to stay connected to the Wireless network after going through day to day workflow. I have used WifiManager.WifiLock in application to make sure hardware running up. But After I have found that my custom OS not able to make it up.

So I have try from my application.

"netcfg" command give me list off network hardware

lo      UP    127.0.0.1       255.0.0.0       0x00000049  
wlan0   DOWN  0.0.0.0         0.0.0.0         0x00001002

"netcfg wlan0 up" And "ifconfig wlan0 up" both are not working from application.

Can any one have any suggestion that I can make hardware up from my application.

Or any other way around like native application class or anything that I can make hardware up.

Eugene S
  • 6,709
  • 8
  • 57
  • 91
Mr. Borad
  • 391
  • 2
  • 24
  • as you have custom hardware, consult the driver specification for that hardware – eriuzo Dec 02 '16 at 10:32
  • You might need to execute the command under `su`. – Onik Dec 02 '16 at 16:10
  • @Onik i have try that also not work. – Mr. Borad Dec 03 '16 at 05:09
  • Can you post logs? Have u tried using settings app and enable wifi? is that working? – siva Dec 07 '16 at 12:29
  • @7383 Yes it working but its not good way to healthy way for may application. i need some thing that can stop making wifi disconnect. – Mr. Borad Dec 07 '16 at 12:31
  • Then why don't you use wifi manager APIs directly froM your app to control wifi? – siva Dec 07 '16 at 12:57
  • @7383 Because I have medical application that run in hospital and most user are patient. Switching OFF and switching ON and connect to last connected wifi. It take almost 30 second and i don't wanna wait my user to that long. – Mr. Borad Dec 07 '16 at 13:01
  • Did you try `svc wifi enable` (it requires root, not sure it fits your needs). Though I didn't understand how using a command will be different from using Wi-Fi manager APIs from your app, at the end wouldn't it do the same thing as any other command? – Fedor Losev Dec 09 '16 at 10:07
  • @FedorLosev Sorry my friend. It's not working. – Mr. Borad Dec 09 '16 at 10:12
  • I think much better than "sorry my friend, It's not working." was to elaborate what is the error and why do you think some command will do what WiFi manager API will not (and add it to the question). This way your question and feedback will be much more valuable and the discussion will be more fruitful and helpful to other users. – Fedor Losev Dec 09 '16 at 10:20

1 Answers1

0

So what I've done is add a service in init.rc file in android os, That checks every 10 seconds if wl1271 firmware state is 'stopped' with 'getprop init.svc.dhcpcd_wlan0' command. If it is anything other than 'stopped', the service does nothing and checks again in 10 seconds. If getprop returns 'stopped', the the command 'ifconfig wlan0 up' is run and the service waits for 30 seconds before checking again.

Mr. Borad
  • 391
  • 2
  • 24