From wiki.ginstr.com
Revision as of 17:25, 24 January 2018 by Mark (talk | contribs) (formatting)
Jump to: navigation, search
added in Milestone 100

gn:act_addServiceListener

Description
Action is used to attach a listener to ginstr launcher service, listeners can be widgets or variables (targets).
When listener is attached to a service it copies all "individual" service parameters configuration from service see more details in gn:act_service serviceParameters to see which parameters are individual.
Global parameters are not copied to the service listener.
Action returns
void

Action signatures

[gn:act_addServiceListener]|[serviceId;target{n}]
Parameter Description
serviceId Name of the service which will be used
  • Valid services:
    • nfc, nfc service
    • gps, gps service
target{n} target which will listen to service event

For nfc service:


For gps service:

  • text if showAddress on service is enabled
  • GPS if showAddress on service is not enabled

Example

Service is started and listener is attached
hardware nfc data
04C357BA482780 - id
initial contents
@+id/screen_nfc_input widget
screen.xml
<FrameLayout
    android:id="@+id/exampleFrame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    gn:act_beforeLoad="[gn:act_service]|[nfc;start],[gn:act_addServiceListener]|[nfc;@+id/screen_nfc_input]" />

 <com.ginstr.widgets.GnEditText
    android:id="@+id/screen_nfc_input"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    gn:dataType="text"
    gn:s_sourceType="input"/>
after nfc scan contents
@+id/screen_nfc_input widget 04C357BA482780