// Path: src/com/beerbong/zipinst/NotificationAlarm.java
// public class NotificationAlarm extends BroadcastReceiver {
// 
//     private RomUpdater mRomUpdater;
// 
//     @Override
//     public void onReceive(Context context, Intent intent) {
// 
//         if (mRomUpdater == null) {
//             mRomUpdater = new RomUpdater(context);
//         }
// 
//         if (SystemProperties.isNetworkAvailable(context)) {
//             mRomUpdater.check();
//         }
//     }
// }


import java.io.BufferedReader;
import java.io.InputStreamReader;
import com.beerbong.zipinst.NotificationAlarm;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/*
 * Copyright 2014 ZipInstaller Project
 *
 * This file is part of ZipInstaller.
 *
 * ZipInstaller is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ZipInstaller is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ZipInstaller.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.beerbong.zipinst.io;




public class SystemProperties {

    private static final int ALARM_ID = 122303221;

    public static String getProperty(String prop) {
        try {
            Process p = Runtime.getRuntime().exec("getprop " + prop);
            p.waitFor();
            BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line = input.readLine();
            return "".equals(line) ? null : line;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    
    public static boolean isNetworkAvailable(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }
    
    public static void setAlarm(Context context, long time, boolean trigger) {

// Path: src/com/beerbong/zipinst/NotificationAlarm.java
// public class NotificationAlarm extends BroadcastReceiver {
// 
//     private RomUpdater mRomUpdater;
// 
//     @Override
//     public void onReceive(Context context, Intent intent) {
// 
//         if (mRomUpdater == null) {
//             mRomUpdater = new RomUpdater(context);
//         }
// 
//         if (SystemProperties.isNetworkAvailable(context)) {
//             mRomUpdater.check();
//         }
//     }
// }


// Path: src/com/beerbong/zipinst/io/SystemProperties.java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import com.beerbong.zipinst.NotificationAlarm;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/*
 * Copyright 2014 ZipInstaller Project
 *
 * This file is part of ZipInstaller.
 *
 * ZipInstaller is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ZipInstaller is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ZipInstaller.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.beerbong.zipinst.io;




public class SystemProperties {

    private static final int ALARM_ID = 122303221;

    public static String getProperty(String prop) {
        try {
            Process p = Runtime.getRuntime().exec("getprop " + prop);
            p.waitFor();
            BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line = input.readLine();
            return "".equals(line) ? null : line;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    
    public static boolean isNetworkAvailable(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }
    
    public static void setAlarm(Context context, long time, boolean trigger) {

        Intent i = new Intent(context, NotificationAlarm.class);