当前位置: 首页>>代码示例>>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;未经允许,请勿转载。