/*
 * Copyright 2014 http://Bither.net
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.bither.receiver;

import net.bither.BitherApplication;
import net.bither.BitherSetting.AppMode;
import net.bither.preference.AppSharedPreference;
import net.bither.util.LogUtil;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class AutosyncReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(final Context context, final Intent intent) {
		LogUtil.d("receiver", intent.getAction());

		// make sure there is always an alarm scheduled
		if (!Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())
				|| intent.getDataString().equals(
						"package:" + context.getPackageName())) {
			if (AppSharedPreference.getInstance().getAppMode() == AppMode.HOT) {
				BitherApplication.getBitherApplication()
						.startBlockchainService(false);
			}
		}
	}
}

@@ -784,16 +784,17 @@
 ogUtil;%0A
+%0A
 import a
@@ -950,17 +950,20 @@
 iver %7B%0A%0A
-%09
+    
 @Overrid
@@ -964,17 +964,20 @@
 verride%0A
-%09
+    
 public v
@@ -1036,18 +1036,84 @@
 tent) %7B%0A
-%09%09
+        if (intent == null) %7B%0A            return;%0A        %7D%0A        
 LogUtil.
@@ -1148,18 +1148,24 @@
 on());%0A%0A
-%09%09
+        
 // make 
@@ -1204,18 +1204,24 @@
 heduled%0A
-%09%09
+        
 if (!Int
@@ -1275,20 +1275,32 @@
 tion())%0A
-%09%09%09%09
+                
 %7C%7C inten
@@ -1325,22 +1325,32 @@
 equals(%0A
-%09%09%09%09%09%09
+                
 %22package
@@ -1383,19 +1383,28 @@
 e())) %7B%0A
-%09%09%09
+            
 if (AppS
@@ -1464,20 +1464,32 @@
 .HOT) %7B%0A
-%09%09%09%09
+                
 BitherAp
@@ -1525,14 +1525,32 @@
 n()%0A
-%09%09%09%09%09%09
+                        
 .sta
@@ -1581,18 +1581,36 @@
 e);%0A
-%09%09%09%7D%0A%09%09%7D%0A%09
+            %7D%0A        %7D%0A    
 %7D%0A%7D%0A

fix null point exception