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

The following examples show how to use android.content.Intent#getDoubleArrayExtra() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: WiFi-RTT-Trilateration   File: MainActivity.java    License: 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 Project: WiFi-RTT-Trilateration   File: MapActivity.java    License: 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
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
/**
 * 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 Project: WiFi-RTT-Trilateration   File: MapActivity.java    License: 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 Project: Ticket-Analysis   File: IntentUtil.java    License: 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);
}