diff --git a/WeBall-Statistics-Mobile/.idea/deploymentTargetDropDown.xml b/WeBall-Statistics-Mobile/.idea/deploymentTargetDropDown.xml index 44d3650c..64e2cea5 100644 --- a/WeBall-Statistics-Mobile/.idea/deploymentTargetDropDown.xml +++ b/WeBall-Statistics-Mobile/.idea/deploymentTargetDropDown.xml @@ -1,9 +1,9 @@ - + - + @@ -11,7 +11,7 @@ - - + + \ No newline at end of file diff --git a/WeBall-Statistics-Mobile/app/src/main/java/uom/team2/weball_statistics/Service/DAOLiveMatchService.java b/WeBall-Statistics-Mobile/app/src/main/java/uom/team2/weball_statistics/Service/DAOLiveMatchService.java index ed160f1a..db0b1fec 100644 --- a/WeBall-Statistics-Mobile/app/src/main/java/uom/team2/weball_statistics/Service/DAOLiveMatchService.java +++ b/WeBall-Statistics-Mobile/app/src/main/java/uom/team2/weball_statistics/Service/DAOLiveMatchService.java @@ -32,6 +32,7 @@ public class DAOLiveMatchService implements DAOCRUDService { public static DAOLiveMatchService instance; private final DatabaseReference databaseReference; + private ValueEventListener listenerForPlayer; private DAOLiveMatchService() { FirebaseDatabase db = FirebaseDatabase.getInstance(); @@ -172,7 +173,12 @@ public void onCancelled(@NonNull DatabaseError error) { } public void setDataListenerForPlayer(LivePlayerStatistics fragment, int matchId, int teamId1) { - databaseReference.addValueEventListener(new ValueEventListener() { + + if (listenerForPlayer != null) { + databaseReference.removeEventListener(listenerForPlayer); + } + + listenerForPlayer = new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { // this method is call to get the realtime @@ -206,7 +212,8 @@ public void onCancelled(@NonNull DatabaseError error) { // calling on cancelled method when we receive // any error or we are not able to get the data. } - }); + }; + databaseReference.addValueEventListener(listenerForPlayer); } // diff --git a/WeBall-Statistics-Mobile/app/src/main/java/uom/team2/weball_statistics/configuration/Config.java b/WeBall-Statistics-Mobile/app/src/main/java/uom/team2/weball_statistics/configuration/Config.java index 1f3020b7..b7064418 100644 --- a/WeBall-Statistics-Mobile/app/src/main/java/uom/team2/weball_statistics/configuration/Config.java +++ b/WeBall-Statistics-Mobile/app/src/main/java/uom/team2/weball_statistics/configuration/Config.java @@ -2,7 +2,7 @@ public class Config { - public static final String IP = "172.21.48.1"; + public static final String IP = "172.26.208.1"; public static final String API_URL = "http://" + IP + "/WeBall_Statistics-Backend/API/"; public static final String MATCHES_API = "http://" + IP + "/weBall_Statistics-Backend/API/match.php"; public static final String API_REFEREE = "referee.php"; diff --git a/WeBall-Statistics-Mobile/app/src/main/res/xml/network_security_config.xml b/WeBall-Statistics-Mobile/app/src/main/res/xml/network_security_config.xml index 4f8e58b5..ee58e3a2 100644 --- a/WeBall-Statistics-Mobile/app/src/main/res/xml/network_security_config.xml +++ b/WeBall-Statistics-Mobile/app/src/main/res/xml/network_security_config.xml @@ -17,10 +17,6 @@ 10.4.22.16 172.21.80.1 192.168.2.66 - 172.25.192.1 - 192.168.1.3 - 192.168.0.119 - 172.27.0.1 - 172.21.48.1 + 172.26.208.1 \ No newline at end of file