added in Milestone 100
gn:act_updateServiceListener
- Description
- Action is used to update a listener thath is attached to ginstr launcher service, listeners can be widgets or variables (targets). When listener attached to a service is updated 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 servicegps
, gps service
target{n}
target id's of the widgets which were already added as listeners to the service via gn:act_addServiceListener action - Valid services:
Example
On before load service is started and default sourceType
is "tagId" configuration is initialized, listener is attached. After that service configuration is changed to sourceType
"embedded". Because "embedded" is individual service parameter we need to update the listener(in this case widget) that it copies and uses the new service configuration.
hardware nfc data
id: 04C357BA482780
embedded: test
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],[gn:act_service]|[nfc;sourceType,embedded],[gn:act_updateServiceListener]|[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
test