plugins.intentShim.registerBroadcastReceiver

Hi,
I have an array :
public tracks =;
and
constructor(
private plt: Platform, private changeDetectorRef: ChangeDetectorRef
) {
this.username = window.atob(localStorage.getItem(‘Token’)).split(’:’)[0];
(window).plugins.intentShim.registerBroadcastReceiver({
filterActions: [
‘com.symbol.datawedge.deluxescanner.ACTION’,
‘com.symbol.datawedge.api.RESULT_ACTION’
],
filterCategories: [
‘android.intent.category.DEFAULT’
]
},
function(intent) {
//alert('Received Intent: ’ + JSON.stringify(intent.extras));
if (intent.extras[“com.symbol.datawedge.data_string”] != null) {
// alert('Scan: ’ + intent.extras[‘com.symbol.datawedge.data_string’]);
const t: string = intent.extras[‘com.symbol.datawedge.data_string’].toString();
alert(t);
this.tracks.unshift(t);
alert(this.tracks[0]);

      }
  }

);
}
alert(t) is showing the correct value but ‘t’ is not inserted in the array by : this.tracks.unshift(t);
Any reason ?
Thanks

Never type the word ‘function’ inside the body of one.

A variable cannot be assigned outside of the scope of (window).plugins.intentShim.registerBroadcastReceiver.