[fpc-pascal] fpcjvm code for examination
Mgr. Janusz Chmiel
janusz.chmiel at volny.cz
Fri Aug 23 14:15:31 CEST 2019
Because my Java knowledge are very very very weak my attempts to call
new Android API functions consists of GOogle search engine which shows
Me some code examples from various WEB pages. And after that, I do my
best to adapt those samples so it would be compatible with FPCJVM
Android target. I have some lines of code and I believe, that there is
some good human being who will examine my short code. Is code is
unusable, please send AN repaired lines.
The biggest issue is, that when interacting with Android APIS, in many
cases, The fact, that run-time library do not report run-time error or
other bug do not mean, that code is really functional. Even The fact,
that Android System UI will not report some crash message it do not mean
that The code is good from The semantic perspective.
Here are my codes.
I Am using AndroidR15 APi headers and Pandroid Bundle.
public
WifiManager : ANWWifiManager;
wakeLock : AOPowerManager;
The code is inside The following procedure.
procedure MainActivity.onCreate(savedInstanceState: AOBundle);
wakeLock := AOPowerManager(getSystemService(ACContext.POWER_SERVICE));
wakeLock.newWakeLock (1, '"Migration');
WifiManager := ANWWifiManager(getSystemService(ACContext.WIFI_SERVICE));
WifiManager.createWifiLock (1,'WIFI_MODE_FULL');
Aim of my attempt is to have more sensitive Wifi chip signal detection
and I want to have Partial Wakelock enabled to prevent Android from auto
terminating unusable app after more time when device is not being
charged and phone screen have been turned off.
The important questions are.
Does my code react? So are those lines functional? Or it do not react at
all and I have some bug?
Sure. I have added The following important Android permissions.
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
I do not have compilation errors The code is example without Begin, ETC.
But I have fully compilable code. I only need to know, if Wifilock and
Wakelock really work or no.
Thank you very much for yours time and help.
More information about the fpc-pascal
mailing list