darryncampbell / GenericScanWedge

Implements an Android service that provides a rudimentary implementation of Zebra's DataWedge than be run on non-Zebra devices
Apache License 2.0
17 stars 8 forks source link

Associate genericscanwedge profile with ReactNative App Demo #2

Closed kranthicodes closed 4 years ago

kranthicodes commented 4 years ago

Hello, Thankyou very much for making this rudimentary implementation of Zebra's DataWedge API to work with non zebra devices.

I got this implementation up and running on my mobile device and I see that there is no way for us to associate or link a created profile with the demo app of DataWedge react native (ofc my api version is below 6.3 so i need to manually create and config the profile according to readme in React Native demo repo.

Though I was successfully able to send intents thru adb to test the concept which was super helpful anyways. If possible please point me in the right direction to link a profile of DataWedge like api with react demo app in some way if the option is not available in the generic app?

Thanks alot. <3

darryncampbell commented 4 years ago

Hi, at the moment this implementation needs to be manually told to switch profiles which is a documented limitation:

- This application does not change the profile dynamically when specific apps are shown. 
As a result the the DataWedge "default" profile and associated functionality has not been implemented

Just to clarify, are you asking how you might implement the 'dynamic' mechanism so the profile associated with the foreground app gets enabled? I want to make sure I understand the question before answering :)

kranthicodes commented 4 years ago

Hey, Thanks for the quick reply. Yes its about the Dynamic Mechanism

Here in the below screenshot of React Native version of the demo, You mentioned "*Associate the profile with com.datawedgereactnative.demo, with Activities (Note: You need to havepreviously run the application on the device to complete this step)**"

I assume the feature marked above in the image has not been implemented in this generic scan wedge app right ? and one has to manually set the profile in react native version of demo app pointing to this generic scan wedge to make it work right?

darryncampbell commented 4 years ago

I assume the feature marked above in the image has not been implemented in this generic scan wedge app right ? and one has to manually set the profile in react native version of demo app pointing to this generic scan wedge to make it work right?

Yes, that is correct. On Zebra devices the team modify the underlying Android source to provide DataWedge with a callback whenever the foreground activity changes and they use this to implement the dynamic mechanism to change the active profile but of course this option is not available to you. If you wanted to add this feature yourself there are a couple of ways to go about doing it, either ActivityManager getRunningTasks or using the Accessibility service & both are given as answers to https://stackoverflow.com/questions/3873659/android-how-can-i-get-the-current-foreground-activity-from-a-service. I have never done this myself but I am told that the ActivityManager getRunningTasks technique is more reliable

kranthicodes commented 4 years ago

If you wanted to add this feature yourself there are a couple of ways to go about doing it, either ActivityManager getRunningTasks or using the Accessibility service

Thanks, Will look into these when moving forward with dynamic mechanism. For now I managed to send available commands from ReactNative App using react-native-datawedge-intents package and was able to successfully trigger the scanner(camera), post scanning received data back to the app for further use. So far everything worked great like I wanted and I greatly appreciate your help.

cmnstmntmn commented 3 years ago

@sai-kranthi-au4 hey,

can you provide a code snippet?

i'm kind of lost making my app work; no idea how i can get the scanner data into the app.

ty