當前位置: 首頁>>代碼示例>>Java>>正文


Java AppInfo類代碼示例

本文整理匯總了Java中org.md2k.mcerebrum.core.access.appinfo.AppInfo的典型用法代碼示例。如果您正苦於以下問題:Java AppInfo類的具體用法?Java AppInfo怎麽用?Java AppInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AppInfo類屬於org.md2k.mcerebrum.core.access.appinfo包,在下文中一共展示了AppInfo類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.md2k.mcerebrum.core.access.appinfo.AppInfo; //導入依賴的package包/類
@Override
public void run() {
    {
        long time = AppInfo.serviceRunningTime(ActivityMain.this, ServicePhoneSensor.class.getName());
        if (time < 0) {
            ((Button) findViewById(R.id.button_app_status)).setText("START");
            findViewById(R.id.button_app_status).setBackground(ContextCompat.getDrawable(ActivityMain.this, R.drawable.button_status_off));

        } else {
            findViewById(R.id.button_app_status).setBackground(ContextCompat.getDrawable(ActivityMain.this, R.drawable.button_status_on));
            ((Button) findViewById(R.id.button_app_status)).setText(DateTime.convertTimestampToTimeStr(time));

        }
        mHandler.postDelayed(this, 1000);
    }
}
 
開發者ID:MD2Korg,項目名稱:mCerebrum-PhoneSensor,代碼行數:17,代碼來源:ActivityMain.java

示例2: initializeUI

import org.md2k.mcerebrum.core.access.appinfo.AppInfo; //導入依賴的package包/類
void initializeUI() {
    setContentView(R.layout.activity_main);
    if (getSupportActionBar() != null)
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final Button buttonService = (Button) findViewById(R.id.button_app_status);
    buttonService.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), ServicePhoneSensor.class);
            if (AppInfo.isServiceRunning(getBaseContext(), ServicePhoneSensor.class.getName())) {
                stopService(intent);
            } else {
                startService(intent);
            }
        }
    });

}
 
開發者ID:MD2Korg,項目名稱:mCerebrum-PhoneSensor,代碼行數:19,代碼來源:ActivityMain.java

示例3: write

import org.md2k.mcerebrum.core.access.appinfo.AppInfo; //導入依賴的package包/類
private void write() {
    boolean flag = AppInfo.isServiceRunning(context, ServicePhoneSensor.class.getName());
    if(flag) context.stopService(new Intent(context, ServicePhoneSensor.class));
    SharedPreferences.Editor editor = sharedPref.edit();
    String result=null;

    for(int i=0;i<geoFenceLocationInfos.size();i++){
        String l=geoFenceLocationInfos.get(i).getLocation();
        String lo= String.valueOf(geoFenceLocationInfos.get(i).getLongitude());
        String la= String.valueOf(geoFenceLocationInfos.get(i).getLatitude());
        if(result==null)
            result=l+"#"+la+"#"+lo;
        else result+="#"+l+"#"+la+"#"+lo;
    }
    if(result==null) result="";

    editor.putString("data", result);
    editor.apply();
    if(flag) context.startService(new Intent(context, ServicePhoneSensor.class));

}
 
開發者ID:MD2Korg,項目名稱:mCerebrum-PhoneSensor,代碼行數:22,代碼來源:GeoFenceData.java

示例4: run

import org.md2k.mcerebrum.core.access.appinfo.AppInfo; //導入依賴的package包/類
@Override
public void run() {
    {
        long time = AppInfo.serviceRunningTime(ActivityMain.this, Constants.SERVICE_NAME);
        if (time < 0) {
            ((TextView) findViewById(R.id.button_app_status)).setText("START");
            findViewById(R.id.button_app_status).setBackground(ContextCompat.getDrawable(ActivityMain.this, R.drawable.button_status_off));

        } else {

            ((TextView) findViewById(R.id.button_app_status)).setText(DateTime.convertTimestampToTimeStr(time));
            findViewById(R.id.button_app_status).setBackground(ContextCompat.getDrawable(ActivityMain.this, R.drawable.button_status_on));
        }
        mHandler.postDelayed(this, 1000);
    }
}
 
開發者ID:MD2Korg,項目名稱:mCerebrum-AutoSense,代碼行數:17,代碼來源:ActivityMain.java

示例5: load

import org.md2k.mcerebrum.core.access.appinfo.AppInfo; //導入依賴的package包/類
void load(){

        final Button buttonService = (Button) findViewById(R.id.button_app_status);

        buttonService.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getApplicationContext(), ServiceAutoSenses.class);
                if (AppInfo.isServiceRunning(getBaseContext(), Constants.SERVICE_NAME)) {
                    stopService(intent);
                } else {
                    startService(intent);
                }
            }
        });
        if (getSupportActionBar() != null)
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
 
開發者ID:MD2Korg,項目名稱:mCerebrum-AutoSense,代碼行數:19,代碼來源:ActivityMain.java

示例6: saveConfigurationFile

import org.md2k.mcerebrum.core.access.appinfo.AppInfo; //導入依賴的package包/類
void saveConfigurationFile() {
        try {
            boolean flag = AppInfo.isServiceRunning(getActivity(), ServicePhoneSensor.class.getName());
            if(flag) getActivity().stopService(new Intent(getActivity(), ServicePhoneSensor.class));

            phoneSensorDataSources.writeDataSourceToFile();
            if(flag) getActivity().startService(new Intent(getActivity(), ServicePhoneSensor.class));

//            Toast.makeText(getActivity(), "Configuration file is saved.", Toast.LENGTH_LONG).show();
        } catch (IOException e) {
            Toast.makeText(getActivity(), "!!!Error:" + e.getMessage(), Toast.LENGTH_LONG).show();
            e.printStackTrace();
        }
    }
 
開發者ID:MD2Korg,項目名稱:mCerebrum-PhoneSensor,代碼行數:15,代碼來源:PrefsFragmentSettings.java

示例7: run

import org.md2k.mcerebrum.core.access.appinfo.AppInfo; //導入依賴的package包/類
@Override
        public void run() {
            if(ServerCP.getServerAddress(context)==null) {
                LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("SERVER_ERROR"));
                stop();
                return;
            }
            if (task != null) {
                handler.removeCallbacks(publishData);
            }
            try {
                task = new CerebralCortexWrapper(context, configuration.upload.restricted_datasource);
                task.setPriority(Thread.MIN_PRIORITY);
                long time = AppInfo.serviceRunningTime(context.getApplicationContext(), org.md2k.datakit.Constants.SERVICE_NAME);
                if (time > 0) { //TWH: TEMPORARY
                    task.start();
                }
            } catch (IOException e) {
/*
                AlertDialogs.AlertDialog(context, "Error", e.getMessage(), R.drawable.ic_error_red_50dp, "Ok", null, null, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                });
*/
            }


            handler.postDelayed(publishData, configuration.upload.interval);
        }
 
開發者ID:MD2Korg,項目名稱:mCerebrum-DataKit,代碼行數:32,代碼來源:CerebralCortexManager.java


注:本文中的org.md2k.mcerebrum.core.access.appinfo.AppInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。