Java Code Examples for android.content.Intent#getDoubleArrayExtra()

The following examples show how to use android.content.Intent#getDoubleArrayExtra() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From WiFi-RTT-Trilateration with MIT License 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent)
{
    if (intent.getAction().equals(Constants.SERVICE_COMMS.MESSAGE))
    {
        //  Debug / info message
        showMessage(intent.getStringExtra(Constants.SERVICE_COMMS.MESSAGE), false);
    }
    else if (intent.getAction().equals(Constants.SERVICE_COMMS.LOCATION_COORDS))
    {
        //  double[] of current coordinates
        double[] centroid = intent.getDoubleArrayExtra(Constants.SERVICE_COMMS.LOCATION_COORDS);
        String sCentroid = "Trilateration (centroid): ";
        for (int i = 0; i < centroid.length; i++)
            sCentroid += "" + (int)centroid[i] + ", ";
        showMessage(sCentroid, true);
    }
    else if (intent.getAction().equals(Constants.SERVICE_COMMS.FINISH))
    {
        finishAffinity();
    }
}
 
Example 2
Source File: MapActivity.java    From WiFi-RTT-Trilateration with MIT License 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent)
{
    if (intent.getAction().equals(Constants.SERVICE_COMMS.LOCATION_COORDS))
    {
        //  double[] of current coordinates
        double[] centroid = intent.getDoubleArrayExtra(Constants.SERVICE_COMMS.LOCATION_COORDS);
        //  todo currently hardcoded for 2D
        movePin(centroid[0], centroid[1], 0.0);
    }
    else if (intent.getAction().equals(Constants.SERVICE_COMMS.FINISH))
    {
        finishAffinity();
    }
}
 
Example 3
Source File: GeoPointMapActivity.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
private void loadViewModeState() {
    Intent intent = getIntent();
    if (intent != null && intent.getExtras() != null) {
        double[] location = intent.getDoubleArrayExtra(GeoPointWidget.LOCATION);
        this.location.setLatitude(location[0]);
        this.location.setLongitude(location[1]);
        this.location.setAltitude(location[2]);
        this.location.setAccuracy((float)location[3]);
        isManualSelectedLocation = true;
        inViewMode = intent.getBooleanExtra(EXTRA_VIEW_ONLY, false);
    }
}
 
Example 4
Source File: GpsServiceUtilities.java    From geopaparazzi with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Utility to get the position from an intent.
 *
 * @param intent the intent.
 * @return the position as lon, lat, elev.
 */
public static double[] getPosition(Intent intent) {
    if (intent == null) {
        return null;
    }
    double[] position = intent.getDoubleArrayExtra(GPS_SERVICE_POSITION);
    return position;
}
 
Example 5
Source File: MapActivity.java    From WiFi-RTT-Trilateration with MIT License 4 votes vote down vote up
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    double[] currentLocation = intent.getDoubleArrayExtra("location");
    movePin(currentLocation[0], currentLocation[1], 0.0);
}
 
Example 6
Source File: IntentUtil.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
public static double[] getDoubleArrayExtra(Intent intent, String name) {
    if (!hasIntent(intent) || !hasExtra(intent, name)) return null;
    return intent.getDoubleArrayExtra(name);
}