登录
首页 » Android » 在Android Studio的指南针

在Android Studio的指南针

于 2022-02-07 发布 文件大小:142.25 kB
0 108
下载积分: 2 下载次数: 1

代码说明:

应用背景景区简介这篇文章解释了如何使用我们的移动设备内置的磁传感器创建我们自己的指南针应用程序。要记住的最重要的事情是,指南针的应用程序通过使用通过在移动设备上的磁力仪传感器提供的数据。所以如果我们移动设备没有这种传感器,指南针的应用程序不能运行它。同时磁力仪是磁或电信号非常敏感。所以要小心你所持有的设备远离任何信号从指南针应用准确的方向。我用下面的图像从cliparts.co我的指南针应用程序:背景在这篇文章中,我使用了一个TextView控件显示角度在该装置的导向。另外,我使用了罗盘图像指向南北方向。为了这一切的工作,该装置的传感器管理器需要初始化应用程序时初始化。同时,我们需要注册设备的方位传感器时应用程序被激活和注销它当应用程序暂停,保存电池。关键技术隐藏 ;复制代码

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • FrameLayoutTest
    android学习工程,主要用framelayout帧布局来实现霓虹灯效果,类似于流水灯一样。(android study engineering, layout of framelayout frame to achieve the neon effect, similar to the light water.)
    2013-04-23 23:20:25下载
    积分:1
  • 视频录制 播放 上传服务器
    视频录制 播放 上传服务器
    2014-03-28下载
    积分:1
  • UDP
    说明:  测试安卓和电脑UDP通讯的源码,项目自带一个winform的客户端(Test the source code of Android and computer UDP communication, the project comes with a winform client)
    2020-05-05 19:39:17下载
    积分:1
  • android 短信拦截 实例完整源码下载
    可实现拦截短信,自动转发的功能。 部分代码:import android.app.AlarmManager;import android.app.PendingIntent;import android.app.Service;import android.content.Context;import android.content.Intent;import android.content.IntentFilter;import android.os.IBinder;import android.os.PowerManager;import android.os.PowerManager.WakeLock;public class MyService extends Service{ SMSReceiver rs=null; static MyService service; private static PendingIntent pi = null; public static AlarmManager am = null; @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); service=this; pm = (PowerManager) getSystemService(Context.POWER_SERVICE); registerAlarm(); acquireWakeLock(this); registerRecever(); } @Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); releaseWakeLock(); unregisterAlarm(); } private void registerRecever(){ rs=new SMSReceiver(); IntentFilter filter=new IntentFilter(); filter.addAction("android.provider.Telephony.SMS_RECEIVED"); filter.setPriority(1000); registerReceiver(rs, filter); } @Override public int onStartCommand(Intent intent, int flags, int startId) { // TODO Auto-generated method stub if(rs==null)registerRecever(); return START_STICKY; } public static WakeLock wakeLock = null; private static PowerManager pm = null; public static synchronized void acquireWakeLock(Context c) { if (null == wakeLock) { wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "smslock"); wakeLock.acquire(); } } public static synchronized void releaseWakeLock() { if (wakeLock == null) return; if (wakeLock.isHeld()) { wakeLock.release(); wakeLock = null; } } /** * 启动重复型定时器 */ public static void registerAlarm() { if(Config.getAlarm())return; Intent intent = new Intent(service, AlarmReceiver.class); pi = PendingIntent.getBroadcast(service, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); // 设置一个PendingIntent对象,发送广播 am = (AlarmManager) service.getSystemService(Context.ALARM_SERVICE); // 获取AlarmManager对象, Config.setAlarm(true); am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 30*60*1000, pi); } /** * 取消定时器 */ public static void unregisterAlarm() { am.cancel(pi); am = null; Config.setAlarm(false); }}
    2014-05-21下载
    积分:1
  • android 拍照实例源码(调用照相机)
    android 拍照实例源码(调用照相机)
    2014-12-23下载
    积分:1
  • GooglePAndroidcode
    全部内容基于Android SDK 随书附赠400多分钟的详细教学视频,286段示例代码 从事一线开发的作者团队提供在线答疑.(GoogleAndroidDevelopment and Practice)
    2013-11-19 14:12:36下载
    积分:1
  • Android完整AchatEngine图表源码
    Android完整AchatEngine图表源码 包含多个系列,都支持水平(默认)或垂直方式展示图表,并且支持许多其他的自定义功能。所有图表都可以建立为一个view,也可以建立为一个用于启动activity的intent. 这个模型和绘图过程的代码进行了很好优化处理,它可以处理和显示值的数量非常大。
    2022-07-23 21:41:44下载
    积分:1
  • beijingyinyueshixianfangfa
    android 的 背景音乐 是 实现方法 ,游戏里面 可以用此方法来实现背景音乐(android' s background music is implementation, the game which you can use this method to achieve the background music)
    2011-08-08 10:36:40下载
    积分:1
  • MojiWeather 演示
    这是我第一次到一个简单的墨迹天气演示、 阅读、 天气年历温度查询的主要功能的发展,我和查询等功能,希望对初学者有所帮助。
    2023-07-15 14:25:04下载
    积分:1
  • android中不错的ExpandableListView实例效果源码
    一、ExpandableListView介绍     一个垂直滚动的显示两个级别(Child,Group)列表项的视图,列表项来自ExpandableListAdapter 。组可以单独展开。   1.重要方法       expandGroup(int groupPos) :在分组列表视图中展开一组,      setSelectedGroup(int groupPosition) :设置选择指定的组。      setSelectedChild(int groupPosition, int childPosition, boolean shouldExpandGroup) :设置选择指定的子项。      getPackedPositionGroup(long packedPosition) :返回所选择的组      getPackedPositionForChild(int groupPosition, int childPosition) :返回所选择的子项      getPackedPositionType(long packedPosition) :返回所选择项的类型(Child,Group)      isGroupExpanded(int groupPosition) :判断此组是否展开  2.代码:ExpandableListContextMenuInfo menuInfo=(ExpandableListContextMenuInfo)item.getMenuInfo();String title=((TextView)menuInfo.targetView).getText().toString();int type=ExpandableListView.getPackedPositionType(menuInfo.packedPosition);if (type==ExpandableListView.PACKED_POSITION_TYPE_CHILD) {int groupPos =ExpandableListView.getPackedPositionGroup(menuInfo.packedPosition);int childPos =ExpandableListView.getPackedPositionChild(menuInfo.packedPosition);二、ExpandableListAdapter    一个接口,将基础数据链接到一个ExpandableListView。此接口的实施将提供访问Child的数据(由组分类),并实例化的Child和Group。 getChildId(int groupPosition, int childPosition) 获取与在给定组给予孩子相关的数据。     getChildrenCount(int groupPosition) 返回在指定Group的Child数目。
    2013-03-07下载
    积分:1
  • 696516资源总数
  • 106648会员总数
  • 8今日下载