Locate User

Locate User

This intent returns a user's location within the same site or department. This intent requires the Location Area Service (LAS) for location data.

Prerequisites

  • The minimum required PTT Pro for Android version is 3.3.10290.
  • The ACTION_PTT _PRO_LOCATE intent must be registered to return the user location.

Intent Definition

Name
Definition
Action
com.symbol.wfc.pttpro.ACTION_PTT_PRO_LOCATE
Intent Type
broadcast
Extra 0
Returns the user's LAS Information.
          Type
String
          Name
user
          Value
  • If the extra name is user
    • Only one user can be configured.
    • The user name is mandatory.
    • The user name is case-sensitive.
    • Use the user name must be exactly as it is created in the PTT Pro server.
    • The user is located only if the user belongs to the same Site ID.
ADB Example:
adb shell am broadcast -a com.symbol.wfc.pttpro.ACTION_PTT_PRO_LOCATE --es user 'Gabriel'

Register Intent

Name
Definition
Action
com.symbol.wfc.pttpro.ACTION_PTT_PRO_LOCATE_STATUS
Extra 0
Returns
locate_status
          Type
Int
          Name
locate_status
          Value
  • 0 indicates a failure and that LAS is not configured or LAS information is unavailable.
  • 1 indicates a response for locating the user.
Extra 1
Returns
locate_result
          Type
String
          Name
locate_result
          Value
If
locate_status
is 1, the user's LAS Information will be shared if
locate_status
returns 1. The user's friendly name is returned in JSON format.
Example:
{ "las_friendly_name": "Fishing Department" }
Extra 2
Returns
locate_error_reason
          Type
String
          Name
locate_error_reason
          Value
If
locate_status
is returned as 0, the
locate_error_reason
provides the details about the failure. The reason can be one of the following:
  • Error while fetching LAS information.
  • The user is not registered.
  • The user is not logged in.
  • The user is not available.
  • LAS is not configured.
Extra 3
Returns
las_user_name
          Type
String
          Name
las_user_name
          Value
Returns the username that is passed as part of the
com.symbol.wfc.pttpro.ACTION_PTT_PRO_LOCATE
intent.

Code Snippet

Send Broadcast
Intent intent = new Intent(); intent.setAction("com.symbol.wfc.pttpro.ACTION_PTT_PRO_LOCATE");   intent.putExtra("user", userName);   sendBroadcast(intent);
Register Intent
IntentFilter locate_intent= new IntentFilter(); locate_intent.addAction("com.symbol.wfc.pttpro.ACTION_PTT_PRO_LOCATE_STATUS"); registerReceiver(mReceiver,locate_intent); public void onReceive(Context context, Intent intent) { String action= intent.getAction(); if(action.equals("com.symbol.wfc.pttpro.ACTION_PTT_PRO_LOCATE_STATUS")) { int locate_status = intent.getIntExtra("locate_status" , 0); String locate_result = intent.getStringExtra("locate_result"); Log.i(TAG, "locate_status : "+locate_status+" locate_result : "+locate_result); } } }