请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AppInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Unmarshaller类代码示例发布时间:2022-05-16
下一篇:
Java XSSFDataFormat类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap