Android Question Help for create wrapper from Indoor Positioning Library

mike1967

Active Member
Licensed User
Longtime User
Hello I have found this projects:
https://hadizadeh.de/indoor-positioning/

The library should be work as the author for android 7.

Can someone advanced users create a wrapper for this lib in order to use with b4a ?
I test the B4X_WrapperHelper.V1.5 withouth results.

Thanks in advanced
 

mike1967

Active Member
Licensed User
Longtime User
Hello,

Just downloaded the above mentioned project, opened the folder and in the libs folder there is a jar : indoor-positioning-1.0.jar

I think (Didn't try yet) you can do the following :
*Also i don't even know what the library does, but judging by the source code it's simple to do in B4A
Step 1
-copy this jar file to B4A additional libraries folder
-then add the add #AdditionalJar : indoor-positioning-1.0

Step 2
-In the same downloaded Project source code folder, navigate to : "src\de\hadizadeh\positioning\example"
-You will find 3 .Java files
Here is the kinda complicated part because you would need to understand what the code does :

-In the B4A project use the inline Java code :
B4X:
#If JAVA
import de.hadizadeh.positioning.controller.PositionListener;
import de.hadizadeh.positioning.controller.PositionManager;
import de.hadizadeh.positioning.controller.Technology;
import de.hadizadeh.positioning.exceptions.PositioningException;
import de.hadizadeh.positioning.exceptions.PositioningPersistenceException;
import de.hadizadeh.positioning.model.PositionInformation;

#End if

The above 6 imports should be founded in the .Jar file

*Final step :
After importing the jar and the imports in the inline java, you will have to start copying and pasting the codes in the 3 java files mentioned before

Example (WifiTechnology.java to B4A inline java) :
B4X:
#If JAVA

import android.content.Context;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import de.hadizadeh.positioning.controller.Technology;
import de.hadizadeh.positioning.model.SignalInformation;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WifiTechnology extends Technology {
    private WifiManager wifiManager;

    public WifiTechnology(Context context, String name, List<String> keyWhiteList) {
        super(name, keyWhiteList);
        wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    }

    @Override
    public Map<String, SignalInformation> getSignalData() {
        Map<String, SignalInformation> signalData =
                new HashMap<String, SignalInformation>();
        wifiManager.startScan();
        List<ScanResult> scanResults = wifiManager.getScanResults();
        for (final ScanResult scanResult : scanResults) {
            signalData.put(scanResult.BSSID, new SignalInformation(scanResult.level));
        }
        return signalData;
    }
}

#End If

-Hit run and it should compile without any problems :
View attachment 112694
How to call method an set properties from b4a code ? I presume with javaobject ?
 
Upvote 0
Top