File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed
app/src/main/java/com/lcl/lclmeasurementtool Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,11 @@ public class MainActivity extends AppCompatActivity {
33
33
protected void onCreate (Bundle savedInstanceState ) {
34
34
super .onCreate (savedInstanceState );
35
35
setContentView (R .layout .activity_main );
36
- mNetworkManager = NetworkManager .getManager (this );
37
- mCellularManager = CellularManager .getManager (this );
38
- mLocationManager = LocationServiceManager .getManager (this );
36
+ mNetworkManager = NetworkManager .getManager (this . getApplicationContext () );
37
+ mCellularManager = CellularManager .getManager (this . getApplicationContext () );
38
+ mLocationManager = LocationServiceManager .getManager (this . getApplicationContext () );
39
39
40
- locationServiceListener = new LocationServiceListener (this , getLifecycle ());
40
+ locationServiceListener = new LocationServiceListener (this . getApplicationContext () , getLifecycle ());
41
41
getLifecycle ().addObserver (locationServiceListener );
42
42
43
43
TextView tv = (TextView ) findViewById (R .id .signalStrengthStatus );
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ private LocationServiceManager(@NonNull Context context) {
56
56
*/
57
57
public static LocationServiceManager getManager (@ NonNull Context context ) {
58
58
if (locationServiceManager == null ) {
59
- locationServiceManager = new LocationServiceManager (context . getApplicationContext () );
59
+ locationServiceManager = new LocationServiceManager (context );
60
60
}
61
61
return locationServiceManager ;
62
62
}
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public class NetworkManager {
34
34
private ConnectivityManager .NetworkCallback networkCallback ;
35
35
36
36
// the connectivity manager object that keeps track of all information
37
- // related to phone's connectivyt states.
37
+ // related to phone's connectivity states.
38
38
private final ConnectivityManager connectivityManager ;
39
39
40
40
// current device supports with regards to networking.
@@ -59,7 +59,6 @@ private NetworkManager(@NonNull Context context) {
59
59
* @return a network manager
60
60
*/
61
61
public static NetworkManager getManager (@ NonNull Context context ) {
62
-
63
62
if (networkManager == null ) {
64
63
networkManager = new NetworkManager (context );
65
64
}
@@ -121,7 +120,7 @@ public void onUnavailable() {
121
120
*
122
121
* @param networkChangeListener the listener to be removed (should not be null)
123
122
*/
124
- public void removeNetworokChangeListener (@ NonNull NetworkChangeListener networkChangeListener ) {
123
+ public void removeNetworkChangeListener (@ NonNull NetworkChangeListener networkChangeListener ) {
125
124
mNetworkChangeListeners .remove (networkChangeListener );
126
125
}
127
126
You can’t perform that action at this time.
0 commit comments