Search in sources :

Example 1 with MarkerData

use of com.secupwn.aimsicd.map.MarkerData in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class MapViewerOsmDroid method loadOcidMarkersByNetwork.

private void loadOcidMarkersByNetwork() {
    // Check if OpenCellID data exists and if so load this now
    List<CellTowerMarker> items = new LinkedList<>();
    String networkOperator = tm.getNetworkOperator();
    int currentMmc = 0;
    int currentMnc = 0;
    if (networkOperator != null && networkOperator.length() > 3) {
        currentMmc = Integer.parseInt(networkOperator.substring(0, 3));
        currentMnc = Integer.parseInt(networkOperator.substring(3));
    }
    Drawable cellTowerMarkerIcon = getResources().getDrawable(R.drawable.ic_map_pin_green);
    @Cleanup Realm realm = Realm.getDefaultInstance();
    RealmResults<Import> importRealmResults = mDbHelper.returnOcidBtsByNetwork(realm, currentMmc, currentMnc).findAll();
    for (Import anImport : importRealmResults) {
        // CellID,Lac,Mcc,Mnc,Lat,Lng,AvgSigStr,Samples
        final int cellID = anImport.getCellId();
        final int lac = anImport.getLocationAreaCode();
        final int mcc = anImport.getMobileCountryCode();
        final int mnc = anImport.getMobileNetworkCode();
        final int psc = anImport.getPrimaryScramblingCode();
        final String rat = anImport.getRadioAccessTechnology();
        final double dLat = anImport.getGpsLocation().getLatitude();
        final double dLng = anImport.getGpsLocation().getLongitude();
        final GeoPoint location = new GeoPoint(dLat, dLng);
        // where is c.getString(6)AvgSigStr
        final int samples = anImport.getSamples();
        // Add map marker for CellID
        CellTowerMarker ovm = new CellTowerMarker(this, mMap, "Cell ID: " + cellID, "", location, new MarkerData(getApplicationContext(), String.valueOf(cellID), String.valueOf(location.getLatitude()), String.valueOf(location.getLongitude()), String.valueOf(lac), String.valueOf(mcc), String.valueOf(mnc), String.valueOf(psc), rat, String.valueOf(samples), false));
        ovm.setIcon(cellTowerMarkerIcon);
        items.add(ovm);
    }
    mCellTowerGridMarkerClusterer.addAll(items);
}
Also used : MarkerData(com.secupwn.aimsicd.map.MarkerData) Import(com.secupwn.aimsicd.data.model.Import) CellTowerMarker(com.secupwn.aimsicd.map.CellTowerMarker) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Cleanup(lombok.Cleanup) LinkedList(java.util.LinkedList) GeoPoint(org.osmdroid.util.GeoPoint) GeoPoint(org.osmdroid.util.GeoPoint) Realm(io.realm.Realm)

Example 2 with MarkerData

use of com.secupwn.aimsicd.map.MarkerData in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class MapFragment method loadOcidMarkersByNetwork.

private void loadOcidMarkersByNetwork() {
    // Check if OpenCellID data exists and if so load this now
    List<CellTowerMarker> items = new LinkedList<>();
    String networkOperator = tm.getNetworkOperator();
    int currentMmc = 0;
    int currentMnc = 0;
    if (networkOperator != null && networkOperator.length() > 3) {
        currentMmc = Integer.parseInt(networkOperator.substring(0, 3));
        currentMnc = Integer.parseInt(networkOperator.substring(3));
    }
    Drawable cellTowerMarkerIcon = getResources().getDrawable(R.drawable.ic_map_pin_green);
    @Cleanup Realm realm = Realm.getDefaultInstance();
    RealmResults<Import> importRealmResults = mDbHelper.returnOcidBtsByNetwork(realm, currentMmc, currentMnc).findAll();
    for (Import anImport : importRealmResults) {
        final int cellID = anImport.getCellId();
        final int lac = anImport.getLocationAreaCode();
        final int mcc = anImport.getMobileCountryCode();
        final int mnc = anImport.getMobileNetworkCode();
        final int psc = anImport.getPrimaryScramblingCode();
        final String rat = anImport.getRadioAccessTechnology();
        final double dLat = anImport.getGpsLocation().getLatitude();
        final double dLng = anImport.getGpsLocation().getLongitude();
        final GeoPoint location = new GeoPoint(dLat, dLng);
        // where is c.getString(6)AvgSigStr
        final int samples = anImport.getSamples();
        // Add map marker for CellID
        CellTowerMarker ovm = new CellTowerMarker(getActivity(), mMap, "Cell ID: " + cellID, "", location, new MarkerData(getContext(), String.valueOf(cellID), String.valueOf(location.getLatitude()), String.valueOf(location.getLongitude()), String.valueOf(lac), String.valueOf(mcc), String.valueOf(mnc), String.valueOf(psc), rat, String.valueOf(samples), false));
        ovm.setIcon(cellTowerMarkerIcon);
        items.add(ovm);
    }
    mCellTowerGridMarkerClusterer.addAll(items);
}
Also used : MarkerData(com.secupwn.aimsicd.map.MarkerData) Import(com.secupwn.aimsicd.data.model.Import) CellTowerMarker(com.secupwn.aimsicd.map.CellTowerMarker) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Cleanup(lombok.Cleanup) LinkedList(java.util.LinkedList) GeoPoint(org.osmdroid.util.GeoPoint) GeoPoint(org.osmdroid.util.GeoPoint) Realm(io.realm.Realm)

Aggregations

BitmapDrawable (android.graphics.drawable.BitmapDrawable)2 Drawable (android.graphics.drawable.Drawable)2 Import (com.secupwn.aimsicd.data.model.Import)2 CellTowerMarker (com.secupwn.aimsicd.map.CellTowerMarker)2 MarkerData (com.secupwn.aimsicd.map.MarkerData)2 Realm (io.realm.Realm)2 LinkedList (java.util.LinkedList)2 Cleanup (lombok.Cleanup)2 GeoPoint (org.osmdroid.util.GeoPoint)2