Recent

Author Topic: LAAMW : 2 question about WiFi & Internet !!  (Read 2551 times)

majid.ebru

  • Sr. Member
  • ****
  • Posts: 494
LAAMW : 2 question about WiFi & Internet !!
« on: March 13, 2017, 09:24:03 am »
Hi
i create a project whit LAMW.
.
1 - how can i detect that the device has WiFi module?
.
2 - how can i notice that the device has Internet ?
(in windows OS , i use "PING" in cmd)

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: LAAMW : 2 question about WiFi & Internet !!
« Reply #1 on: March 13, 2017, 09:41:05 am »
Have you tried to use the Search feature in this forum?

If I remember correctly, this question have already answered. So, you can search for it using the keyword: "LAMW wifi".

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: LAAMW : 2 question about WiFi & Internet !!
« Reply #2 on: March 14, 2017, 03:00:30 am »
You can try enable wifi:
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.AndroidModule1JNIPrompt(Sender: TObject);
  2. begin
  3.   if not Self.isConnected() then
  4.   begin //try wifi
  5.     if Self.SetWifiEnabled(True) then
  6.       ShowMessage('Wifi is On!');  
  7.     else
  8.       ShowMessage('Please,  try enable some connection...');
  9.   end
  10.   else
  11.   begin
  12.      if Self.isConnectedWifi() then  ShowMessage('Wifi is On!');  
  13.   end;
  14. end;
  15.  

and you can check your connection status:

Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jButton1Click(Sender: TObject);
  2. var
  3.   netStatus: TNetworkStatus;
  4. begin
  5.  
  6.    netStatus:= Self.GetNetworkStatus();
  7.  
  8.    if netStatus = nsOff then
  9.    begin
  10.     ShowMessage('Network is Off');
  11.     Exit;
  12.    end;
  13.  
  14.    if netStatus = nsMobileDataOn then
  15.    begin
  16.      //ShowMessage(Self.GetDeviceDataMobileIPAddress() );
  17.      ShowMessage('Network Mobile Data is On');
  18.      Exit;
  19.    end;
  20.  
  21.    if netStatus = nsWifiOn then
  22.    begin
  23.      ShowMessage('Wifi Device IP: ' + Self.GetDeviceWifiIPAddress());
  24.      ShowMessage('Wifi Broadcast IP: '  + Self.GetWifiBroadcastIPAddress());
  25.    end;
  26.  
  27. end;
  28.  
« Last Edit: March 14, 2017, 03:03:10 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

majid.ebru

  • Sr. Member
  • ****
  • Posts: 494
Re: LAAMW : 2 question about WiFi & Internet !!
« Reply #3 on: March 14, 2017, 04:46:42 am »
Thanks
.
.
i want  to know that dose WiFi module exist in the device??

 

TinyPortal © 2005-2018