// Path: androidpn/src/main/java/org/androidpn/client/ServiceManager.java
// public final class ServiceManager {
// 
//     private static final String LOGTAG = LogUtil
//             .makeLogTag(ServiceManager.class);
// 
//     private Context context;
// 
//     private SharedPreferences sharedPrefs;
// 
//     private Properties props;
// 
//     private String version = "0.7.0";
// 
//     private String apiKey;
// 
//     private String xmppHost;
// 
//     private String xmppPort;
// 
//     private String callbackActivityPackageName;
// 
//     private String callbackActivityClassName;
// 
//     public ServiceManager(Context context) {
//         this.context = context;
// 
//         if (context instanceof Activity) {
//             Log.i(LOGTAG, "Callback Activity...");
//             Activity callbackActivity = (Activity) context;
//             callbackActivityPackageName = callbackActivity.getPackageName();
//             callbackActivityClassName = callbackActivity.getClass().getName();
//         }
// 
//         props = loadProperties();
//         apiKey = props.getProperty(Constants.PROP_API_KEY, "");
//         xmppHost = props.getProperty(Constants.PROP_XMPP_HOST, Constants.DEFAULT_HOST);
//         xmppPort = props.getProperty(Constants.PROP_XMPP_PORT, Constants.DEFAULT_PORT);
//         NotifierConfig.packetListener = props.getProperty(Constants.PROP_PACKET_LISTENER, null);
//         NotifierConfig.iq = props.getProperty(Constants.PROP_IQ, null);
//         NotifierConfig.iqProvider = props.getProperty(Constants.PROP_IQ_PROVIDER, null);
//         NotifierConfig.notifyActivity = props.getProperty(Constants.PROP_NOTIFY_ACTIVITY, null);
//         Log.i(LOGTAG, "apiKey=" + apiKey);
//         Log.i(LOGTAG, "xmppHost=" + xmppHost);
//         Log.i(LOGTAG, "xmppPort=" + xmppPort);
//         Log.i(LOGTAG, "packetListener=" + NotifierConfig.packetListener);
//         Log.i(LOGTAG, "iq=" + NotifierConfig.iq);
//         Log.i(LOGTAG, "iqProvider=" + NotifierConfig.iqProvider);
//         Log.i(LOGTAG, "notifyActivity" + NotifierConfig.notifyActivity);
// 
//         sharedPrefs = context.getSharedPreferences(
//                 Constants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
//         Editor editor = sharedPrefs.edit();
//         editor.putString(Constants.API_KEY, apiKey);
//         editor.putString(Constants.VERSION, version);
//         editor.putString(Constants.XMPP_HOST, xmppHost);
//         editor.putInt(Constants.XMPP_PORT, Integer.parseInt(xmppPort));
//         editor.putString(Constants.CALLBACK_ACTIVITY_PACKAGE_NAME,
//                 callbackActivityPackageName);
//         editor.putString(Constants.CALLBACK_ACTIVITY_CLASS_NAME,
//                 callbackActivityClassName);
//         editor.commit();
//         SmackConfiguration.setKeepAliveInterval(60000);
//     }
// 
//     public void startService() {
//         Thread serviceThread = new Thread(new Runnable() {
//             @Override
//             public void run() {
//                 Intent intent = NotificationService.getIntent(context);
//                 context.startService(intent);
//             }
//         });
// 
//         serviceThread.start();
//     }
// 
//     public void stopService() {
//         Intent intent = NotificationService.getIntent(context);
//         context.stopService(intent);
//     }
// 
//     private Properties loadProperties() {
//         Properties props = new Properties();
//         try {
//             int id = context.getResources().getIdentifier(Constants.PROP_FILE_NAME, "raw",
//                     context.getPackageName());
//             props.load(context.getResources().openRawResource(id));
//         } catch (Exception e) {
//             Log.e(LOGTAG, "Could not find the properties file.", e);
//         }
//         return props;
//     }
// 
//     public void setNotificationIcon(int iconId) {
//         Editor editor = sharedPrefs.edit();
//         editor.putInt(Constants.NOTIFICATION_ICON, iconId);
//         editor.commit();
//     }
// 
//     public static void viewNotificationSettings(Context context) {
//         Intent intent = new Intent().setClass(context,
//                 NotificationSettingsActivity.class);
//         context.startActivity(intent);
//     }
// 
// }


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.githang.android.apnbb.demo.R;
import org.androidpn.client.LogUtil;
import org.androidpn.client.ServiceManager;
package com.githang.android.apnbb.demo.notify;





public class AutoRunReceiver extends BroadcastReceiver {
    private static final String LOG_TAG = LogUtil.makeLogTag(AutoRunReceiver.class);
    public AutoRunReceiver() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if(Intent.ACTION_BOOT_COMPLETED.equals(action)) {
            Log.d(LOG_TAG, "action_boot_completed");
// Path: androidpn/src/main/java/org/androidpn/client/ServiceManager.java
// public final class ServiceManager {
// 
//     private static final String LOGTAG = LogUtil
//             .makeLogTag(ServiceManager.class);
// 
//     private Context context;
// 
//     private SharedPreferences sharedPrefs;
// 
//     private Properties props;
// 
//     private String version = "0.7.0";
// 
//     private String apiKey;
// 
//     private String xmppHost;
// 
//     private String xmppPort;
// 
//     private String callbackActivityPackageName;
// 
//     private String callbackActivityClassName;
// 
//     public ServiceManager(Context context) {
//         this.context = context;
// 
//         if (context instanceof Activity) {
//             Log.i(LOGTAG, "Callback Activity...");
//             Activity callbackActivity = (Activity) context;
//             callbackActivityPackageName = callbackActivity.getPackageName();
//             callbackActivityClassName = callbackActivity.getClass().getName();
//         }
// 
//         props = loadProperties();
//         apiKey = props.getProperty(Constants.PROP_API_KEY, "");
//         xmppHost = props.getProperty(Constants.PROP_XMPP_HOST, Constants.DEFAULT_HOST);
//         xmppPort = props.getProperty(Constants.PROP_XMPP_PORT, Constants.DEFAULT_PORT);
//         NotifierConfig.packetListener = props.getProperty(Constants.PROP_PACKET_LISTENER, null);
//         NotifierConfig.iq = props.getProperty(Constants.PROP_IQ, null);
//         NotifierConfig.iqProvider = props.getProperty(Constants.PROP_IQ_PROVIDER, null);
//         NotifierConfig.notifyActivity = props.getProperty(Constants.PROP_NOTIFY_ACTIVITY, null);
//         Log.i(LOGTAG, "apiKey=" + apiKey);
//         Log.i(LOGTAG, "xmppHost=" + xmppHost);
//         Log.i(LOGTAG, "xmppPort=" + xmppPort);
//         Log.i(LOGTAG, "packetListener=" + NotifierConfig.packetListener);
//         Log.i(LOGTAG, "iq=" + NotifierConfig.iq);
//         Log.i(LOGTAG, "iqProvider=" + NotifierConfig.iqProvider);
//         Log.i(LOGTAG, "notifyActivity" + NotifierConfig.notifyActivity);
// 
//         sharedPrefs = context.getSharedPreferences(
//                 Constants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
//         Editor editor = sharedPrefs.edit();
//         editor.putString(Constants.API_KEY, apiKey);
//         editor.putString(Constants.VERSION, version);
//         editor.putString(Constants.XMPP_HOST, xmppHost);
//         editor.putInt(Constants.XMPP_PORT, Integer.parseInt(xmppPort));
//         editor.putString(Constants.CALLBACK_ACTIVITY_PACKAGE_NAME,
//                 callbackActivityPackageName);
//         editor.putString(Constants.CALLBACK_ACTIVITY_CLASS_NAME,
//                 callbackActivityClassName);
//         editor.commit();
//         SmackConfiguration.setKeepAliveInterval(60000);
//     }
// 
//     public void startService() {
//         Thread serviceThread = new Thread(new Runnable() {
//             @Override
//             public void run() {
//                 Intent intent = NotificationService.getIntent(context);
//                 context.startService(intent);
//             }
//         });
// 
//         serviceThread.start();
//     }
// 
//     public void stopService() {
//         Intent intent = NotificationService.getIntent(context);
//         context.stopService(intent);
//     }
// 
//     private Properties loadProperties() {
//         Properties props = new Properties();
//         try {
//             int id = context.getResources().getIdentifier(Constants.PROP_FILE_NAME, "raw",
//                     context.getPackageName());
//             props.load(context.getResources().openRawResource(id));
//         } catch (Exception e) {
//             Log.e(LOGTAG, "Could not find the properties file.", e);
//         }
//         return props;
//     }
// 
//     public void setNotificationIcon(int iconId) {
//         Editor editor = sharedPrefs.edit();
//         editor.putInt(Constants.NOTIFICATION_ICON, iconId);
//         editor.commit();
//     }
// 
//     public static void viewNotificationSettings(Context context) {
//         Intent intent = new Intent().setClass(context,
//                 NotificationSettingsActivity.class);
//         context.startActivity(intent);
//     }
// 
// }


// Path: demo/src/main/java/com/githang/android/apnbb/demo/notify/AutoRunReceiver.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.githang.android.apnbb.demo.R;
import org.androidpn.client.LogUtil;
import org.androidpn.client.ServiceManager;

package com.githang.android.apnbb.demo.notify;





public class AutoRunReceiver extends BroadcastReceiver {
    private static final String LOG_TAG = LogUtil.makeLogTag(AutoRunReceiver.class);
    public AutoRunReceiver() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if(Intent.ACTION_BOOT_COMPLETED.equals(action)) {
            Log.d(LOG_TAG, "action_boot_completed");
            final ServiceManager serviceManager = new ServiceManager(context);