From wiki.ginstr.com
Jump to: navigation, search
m (formatting)
Line 3: Line 3:
 
[[Category:Action_Library]]
 
[[Category:Action_Library]]
  
;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.
+
;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 <code>[[gn:act_service]]</code> serviceParameters to see which parameters are individual.
 +
:Global parameters are not copied to the service listener.
 
;Action returns: void
 
;Action returns: void
 
==Action signatures==
 
==Action signatures==
Line 33: Line 35:
  
 
====Example====
 
====Example====
Service is started and listener is attached
+
:Service is started and listener is attached
  
 
=====hardware nfc data=====
 
=====hardware nfc data=====
id: <code>04C357BA482780</code>
+
::<code>04C357BA482780</code> - id
  
 
=====initial contents=====
 
=====initial contents=====
@+id/screen_nfc_input widget
+
::<code>@+id/screen_nfc_input widget</code> <code></code>
<code></code>
 
  
 
=====screen.xml=====
 
=====screen.xml=====
Line 60: Line 61:
  
 
=====after nfc scan contents=====
 
=====after nfc scan contents=====
@+id/screen_nfc_input widget
+
::<code>@+id/screen_nfc_input widget</code> <code>04C357BA482780</code>
<code>04C357BA482780</code>
 
 
<hr>
 
<hr>

Revision as of 17:25, 24 January 2018

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