Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #11 from darryncampbell/duplicateBroadcastReceiver…
Browse files Browse the repository at this point in the history
  • Loading branch information
darryncampbell authored Nov 9, 2020
2 parents bab7548 + 0ff0ead commit 33f90be
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ android {
minSdkVersion safeExtGet('minSdkVersion', 16)
//noinspection OldTargetApi
targetSdkVersion safeExtGet('targetSdkVersion', 27)
targetSdkVersion 21
versionCode 7
versionName "0.0.1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,19 @@ public RNDataWedgeIntentsModule(ReactApplicationContext reactContext) {
@Override
public void onHostResume() {
//Log.v(TAG, "Host Resume");
IntentFilter filter = new IntentFilter();
filter.addAction(ACTION_ENUMERATEDLISET);
reactContext.registerReceiver(myEnumerateScannersBroadcastReceiver, filter);
if (this.registeredAction != null)

// Note regarding registerBroadcastReceiver:
// This module makes no attempt to unregister the receiver when the application is paused and re-registers the
// receiver when the application comes to the foreground. Feel free to fork and add this logic to your solution if
// required - I have found in the past this has led to confusion.
// The logic below refers to the now deprecated broadcast receivers.

IntentFilter filter = new IntentFilter();
filter.addAction(ACTION_ENUMERATEDLISET);
reactContext.registerReceiver(myEnumerateScannersBroadcastReceiver, filter);
if (this.registeredAction != null)
registerReceiver(this.registeredAction, this.registeredCategory);

// Note regarding registerBroadcastReceiver:
// This module makes no attempt to unregister the receiver when the application is paused and re-registers the
// receiver when the application comes to the foreground. Feel free to fork and add this logic to your solution if
// required - I have found in the past this has led to confusion.
}

@Override
Expand All @@ -115,6 +118,7 @@ public void onHostPause() {
// This module makes no attempt to unregister the receiver when the application is paused and re-registers the
// receiver when the application comes to the foreground. Feel free to fork and add this logic to your solution if
// required - I have found in the past this has led to confusion.
// The logic below refers to the now deprecated broadcast receivers.
try
{
this.reactContext.unregisterReceiver(myEnumerateScannersBroadcastReceiver);
Expand Down Expand Up @@ -426,7 +430,7 @@ public void onReceive(Context context, Intent intent) {
}
};

public BroadcastReceiver genericReceiver = new BroadcastReceiver()
public static BroadcastReceiver genericReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context context, Intent intent) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-datawedge-intents",
"version": "0.1.2",
"version": "0.1.3",
"description": "React Native Android module to interface with Zebra's DataWedge using Android Intents to control the barcode scanner and retrieve scanned data",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 33f90be

Please sign in to comment.