rename to FDroidApp.restartLocalRepoServiceIfRunning() for clarity
This method handles checking if the service is running, and only restarts it if it was running.
This commit is contained in:
		
							parent
							
								
									c1b0b854fc
								
							
						
					
					
						commit
						6703fa3652
					
				| @ -67,7 +67,7 @@ public class FDroidApp extends Application { | ||||
|     // for the local repo on this device, all static since there is only one | ||||
|     public static int port; | ||||
|     public static String ipAddressString; | ||||
|     public static String ssid ; | ||||
|     public static String ssid; | ||||
|     public static String bssid; | ||||
|     public static final Repo repo = new Repo(); | ||||
|     public static Set<String> selectedApps = null; // init in SelectLocalAppsFragment | ||||
| @ -337,7 +337,10 @@ public class FDroidApp extends Application { | ||||
|         app.stopService(new Intent(app, LocalRepoService.class)); | ||||
|     } | ||||
| 
 | ||||
|     public static void restartLocalRepoService() { | ||||
|     /** | ||||
|      * Handles checking if the {@link LocalRepoService} is running, and only restarts it if it was running. | ||||
|      */ | ||||
|     public static void restartLocalRepoServiceIfRunning() { | ||||
|         if (localRepoServiceMessenger != null) { | ||||
|             try { | ||||
|                 Message msg = Message.obtain(null, LocalRepoService.RESTART, LocalRepoService.RESTART, 0); | ||||
|  | ||||
| @ -127,7 +127,7 @@ public class WifiStateChangeService extends Service { | ||||
|             Intent intent = new Intent(BROADCAST); | ||||
|             LocalBroadcastManager.getInstance(WifiStateChangeService.this).sendBroadcast(intent); | ||||
|             WifiStateChangeService.this.stopSelf(); | ||||
|             FDroidApp.restartLocalRepoService(); | ||||
|             FDroidApp.restartLocalRepoServiceIfRunning(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hans-Christoph Steiner
						Hans-Christoph Steiner