darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 130 forks source link

unable to add intent value to my array #98

Closed cissemy closed 4 years ago

cissemy commented 4 years ago

Hi, I have : public tracks = []; 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); // changeDetectorRef.detectChanges(); } } for some reason the array tracks does not get any value. Thanks

darryncampbell commented 4 years ago

Does alert(t); show the correct value?

cissemy commented 4 years ago

Hi, Yes alert(t) show the correct value.

On Tue, Feb 4, 2020 at 9:58 AM Darryn notifications@github.com wrote:

Does alert(t); show the correct value?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/issues/98?email_source=notifications&email_token=AAAVJCK72O3IGVWTTTSKOR3RBF7A7A5CNFSM4KPXJS3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKX5PUY#issuecomment-581949395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVJCIDDQMTYH7J3Q5FPE3RBF7A7ANCNFSM4KPXJS3A .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy commented 4 years ago

I have export class ListbarcodePage implements OnInit { public tracks = []; constructor(private plt: Platform, private changeDetectorRef: ChangeDetectorRef){ (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); // changeDetectorRef.detectChanges(); } } } }

darryncampbell commented 4 years ago

Strange - do you think it is related to the plugin? You are already calling toString() so I don't know what else the plugin could be doing wrong. Is this.tracks.unshift.. definitely pointing to the tracks declared earlier?

cissemy commented 4 years ago

Yes it is pointing to . Even this.tracks.push(t) does not have a value. Can you provide me an email ? i will send you my full source code.

On Tue, Feb 4, 2020 at 10:16 AM Darryn notifications@github.com wrote:

Strange - do you think it is related to the plugin? You are already calling toString() so I don't know what else the plugin could be doing wrong. Is this.tracks.unshift.. definitely pointing to the tracks declared earlier?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/issues/98?email_source=notifications&email_token=AAAVJCM26VDM4TIX526C3Z3RBGBGRA5CNFSM4KPXJS3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKX7UAI#issuecomment-581958145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVJCPYRVIKNSDED7HSBA3RBGBGRANCNFSM4KPXJS3A .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

cissemy commented 4 years ago

Hi Darryn, Any solution ? Thanks & Regards

On Tue, Feb 4, 2020 at 10:22 AM CISSE M.Y. cissemy@gmail.com wrote:

Yes it is pointing to . Even this.tracks.push(t) does not have a value. Can you provide me an email ? i will send you my full source code.

On Tue, Feb 4, 2020 at 10:16 AM Darryn notifications@github.com wrote:

Strange - do you think it is related to the plugin? You are already calling toString() so I don't know what else the plugin could be doing wrong. Is this.tracks.unshift.. definitely pointing to the tracks declared earlier?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/issues/98?email_source=notifications&email_token=AAAVJCM26VDM4TIX526C3Z3RBGBGRA5CNFSM4KPXJS3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKX7UAI#issuecomment-581958145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVJCPYRVIKNSDED7HSBA3RBGBGRANCNFSM4KPXJS3A .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028

darryncampbell commented 4 years ago

I'm not an expert in Javascript I'm afraid so I'm not sure if I can help... I did try with local variables and it seemed to work OK:

var t = scanData.extras["com.symbol.datawedge.data_string"];
var tracks = [];
tracks.unshift(t);
alert(t);
alert(tracks[0]);
cissemy commented 4 years ago

Hi, I did check. The plugin is not reading a variable outside the scope.

On Thu, Feb 6, 2020 at 3:14 AM Darryn notifications@github.com wrote:

I'm not an expert in Javascript I'm afraid so I'm not sure if I can help... I did try with local variables and it seemed to work OK:

var t = scanData.extras["com.symbol.datawedge.data_string"];var tracks = [];tracks.unshift(t);alert(t);alert(tracks[0]);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/issues/98?email_source=notifications&email_token=AAAVJCJAW4IVIJKI3FNQNGTRBPBGTA5CNFSM4KPXJS3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEK6J2SA#issuecomment-582786376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVJCPIKHBM5XHNKVVK6SLRBPBGTANCNFSM4KPXJS3A .

-- CISSE M. Y. Sofware/Web Developer Phone :(347) 443-9028