(→Action signatures) |
m (formatting) |
||
Line 3: | Line 3: | ||
[[Category:Action_Library]] | [[Category:Action_Library]] | ||
− | ;Description: Action is used to remove a listener that is attached to ginstr launcher service, listeners can be widgets or variables (targets). When listener attached to a service is removed it will stop receiving any updates from service. i.e. if | + | ;Description: Action is used to remove a listener that is attached to [[ginstr launcher]] service, listeners can be widgets or variables ([[target|targets]]). |
+ | |||
+ | :When listener attached to a service is removed it will stop receiving any updates from service. | ||
+ | ::i.e. if [[NFC]] listener (widget or variable) is removed from service, on scan of [[NFC]] that target will no longer receive tag content. | ||
;Action returns: void | ;Action returns: void | ||
==Action signatures== | ==Action signatures== | ||
Line 25: | Line 28: | ||
====Example==== | ====Example==== | ||
− | On before load service is started, listener is attached. After first | + | On before load service is started, listener is attached. After first [[NFC]] scan we decided that action set <code>[[gn:act_set]]</code> should be executed and we no longer want to save [[NFC]] scan events into widget so we call <code>[[gn:act_removeServiceListener]]</code>. If we have 2 [[NFC#NFC_Tags|tags]] A and B, only the [[NFC#NFC_Tags|tag]] that is scanned first after coming to the screen will be stored to listener because upon scan we remove the listener so any subsequent scan will not store data to any listener. |
=====hardware nfc data===== | =====hardware nfc data===== | ||
− | + | ::<code>04C357BA482780</code> - [[NFC#NFC_Tags|TAG]] A id | |
− | + | ||
− | + | ::<code>99C357BA482799</code> - [[NFC#NFC_Tags|TAG]] B 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 56: | Line 57: | ||
=====after first nfc scan of TAG A contents===== | =====after first nfc scan of TAG A contents===== | ||
− | @+id/screen_nfc_input widget | + | ::<code>@+id/screen_nfc_input widget</code> <code>04C357BA482780</code> |
− | <code>04C357BA482780</code> | ||
=====after second nfc scan of TAG B contents===== | =====after second nfc scan of TAG B 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:20, 24 January 2018
added in Milestone 100
gn:act_removeServiceListener
- Description
- Action is used to remove a listener that is attached to ginstr launcher service, listeners can be widgets or variables (targets).
- When listener attached to a service is removed it will stop receiving any updates from service.
- 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, listener is attached. After first NFC scan we decided that action set gn:act_set
should be executed and we no longer want to save NFC scan events into widget so we call gn:act_removeServiceListener
. If we have 2 tags A and B, only the tag that is scanned first after coming to the screen will be stored to listener because upon scan we remove the listener so any subsequent scan will not store data to any listener.
hardware nfc data
04C357BA482780
- TAG A id
99C357BA482799
- TAG B 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;triggerActionSet,@+id/exampleFrame,gn:act_set],[gn:act_addServiceListener]|[nfc;@+id/screen_nfc_input]" gn:act_set="[gn:act_removeServiceListener]|[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 first nfc scan of TAG A contents
@+id/screen_nfc_input widget
04C357BA482780
after second nfc scan of TAG B contents
@+id/screen_nfc_input widget
04C357BA482780