- 博客(59)
- 收藏
- 关注
原创 JNI 本地引用和全局引用
1. 概述:在JNI中 支持三种难懂的引用,分别是:本地引用(local references),全局引用( global references),弱全局引用(weak global references.)。本地引用和全局引用有不同的生命周期,本地引用被自动释放,而全局引用和弱全局引用需要程序员来释放。本地引用和全局引用阻止被垃圾回收,另一方面,弱全局引用允许被垃圾回收不是所有的引用
2013-07-23 18:29:11 1505
原创 JNI 编译问题
最近在阅读有关jni的文档,想在Ubuntu下尝试一下文档中的简单例子,结果出现一些编译错误等一系列问题。这里将整个流程以及遇到的问题共享给大家。1.配置java环境其实我们只要从官网下载java JDK ,之后解压便成。例如这里我是从如下网址下载的 jdk1.7 :http://www.oracle.com/technetwork/java/javase/downloads/jd
2013-06-21 15:17:41 867
原创 Android 保存数据到数据库
保存数据到一个数据库对重复或结构化的数据是理想的,例如联系人信息。假定您熟悉一般的SQL数据库,有助于您在android中使用SQLite数据库,您使用android数据库的API包在“android.database.sqlite”中。定义架构(Schema) 和合同(Contract)SQL 数据库主要原理之一是架构(Schema): 一个怎样组织数据库的正式声明。
2013-06-16 14:33:41 1911
原创 android 电源管理(PowerManager)
1. 概述PowerManager 管理设备的电源状态。它的使用会显著地影响到设备电池寿命,除非的确需要,轻易不要获取PowerManager唤醒锁(PowerManager.WakeLock),而且尽可能使用最小级别,一定要尽快释放。您可以通过调用Context.getSystemService()获取PowerManager 的实例,以及使用newWakeLock()方法创建Pow
2013-06-08 15:01:22 1654
原创 android 后台运行服务之报告工作状态篇
3.报告工作状态这里将讲述如何将运行于后台服务的工作请求的结果状态报告给发送该请求的组件,例如:这里允许您发送请求结果状态给UI 对象中的某个Activity, 发送和接收结果状态推荐使用LocalBroadcastManager,这样限制了广播的Intent对象组件在您自己的应用中。a. 来自IntentService 的报告状态为了发送在一个IntentService中的工
2013-06-04 18:45:27 990
原创 android 后台运行服务之发送工作请求给后台服务篇
前一篇讲述了如何创建一个IntentService 类, 这里将继续讲述如何发送一个Intent 给IntentService触发运行某个操作。您可以发送包含可选数据的intent给intentService 去处理,可以在一个Activity 或者Fragment 如何地方发送一个intent 给一个IntentService。2.创建和发送一个工作请求给IntentService
2013-06-04 17:06:18 1281
原创 android 后台运行服务之创建后台服务篇
除非另行指定,大部分应用程序操作在前台称作为UI 线程的特殊线程中运行。这可能会造成问题,因为长时间运行的操作会影响你的用户界面的响应。这干扰用户交互操作,甚至可能导致系统错误。为了避免这种情况,Android框架提供了一些类,帮助您关闭负载操作放在一个独立运行于后台的线程。最有用的是intentservice。接下来将描述如下三种操作。1. 创建一个后台服务这IntentSe
2013-06-04 16:20:30 1913
转载 打开Android C文件中的LOG
打开Android C文件中的LOG可以一次打开LOGV,LOGI,LOGD,也可以分别打开: #undef NDEBUG //打开LOGV/LOGI/LOGD#define LOG_NDEBUG 0 //打开LOGV#define LOG_NIDEBUG 0 //打开LOGI#define LOG_NDDEBUG 0 //打开LOGD
2012-09-05 20:18:45 1507
原创 scp的用法
1.在linux 环境下,使用man SCP 将有如下帮助。NAME scp — secure copy (remote file copy program)SYNOPSIS scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option]
2012-08-23 16:47:20 817
转载 Android Tombstone/Crash的log分析和定位
有一句话叫做常在河边走,哪有不湿鞋。我们这些研究和开发Android的工程师正应了这句话,相必大家在调试的时候经常会遇到这么个东西吧*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***Build fingerprint: 'XXXXXXXXX'pid: 1658, tid: 13086 >>> system_s
2012-08-14 18:18:47 922
转载 Android 信号处理面面观 之 信号定义、行为和来源
传统 Unix系统的信号定义和行为所有的符合Unix规范(如POSIX)的系统都统一定义了SIGNAL的数量、含义和行为。 作为Linux系统,Android自然不会更改SIGNAL的定义。在Android代码中,signal的定义一般在 signum.h (prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/u
2012-08-14 18:07:49 808
转载 Debugging with GDB
The current version of envsetup.sh has a gdbclient command that handles much of the setup. For example, to attach the already-runningglobaltime application, execute the following, making sure that: 1)
2012-07-20 17:07:09 636
转载 Debugging Native Code
Capturing logsTo capture log output:Produce a process list with ps (ps -t if you want verbose thread feedback).Dump kernel messages with dmesg.Get verbose log messages with logcat '*:v' & (runni
2012-07-20 17:06:27 969
转载 Debugging with tcpdump and other tools
Installing tcpdumpRunning tcpdumpOther network debugging commandsInstalling tcpdumpPushing the binary to an existing deviceDownload tcpdump from http://www.tcpdump.org/, then execute:adb
2012-07-20 17:05:44 534
转载 Instrumentation Testing
This document describes how to use the Instrumentation Framework to write test cases. Instrumentation testing allows you to verify a particular feature or behavior with an automated JUnit TestCase. Yo
2012-07-19 10:45:34 853
转载 Dalvik
The Dalvik virtual machine is intended to run on a variety of platforms.The baseline system is expected to be a variant of UNIX (Linux, BSD, MacOS X) running the GNU C compiler. Little-endian CPUs hav
2012-07-19 10:44:36 1451 1
转载 Sim Toolkit Application (STK)
This document offers a high-level overview of the SIM Toolkit Application for Android 1.0 and is primarily of interest for implementors of the Radio Interface Layer (RIL). The STK is R96 compatible (3
2012-07-19 10:42:30 1325
转载 Radio Layer Interfac
Android's Radio Interface Layer (RIL) provides an abstraction layer between Android telephony services (android.telephony) and radio hardware. The RIL is radio agnostic, and includes support for Glo
2012-07-19 10:41:41 1003
转载 Sensors
Android defines a user space C abstraction interface for sensor hardware. The interface header is defined inhardware/libhardware/include/hardware/sensors.h.In order to integrate sensors with Android
2012-07-19 10:40:56 664
转载 Power Management
IntroductionWake LocksTypes of Wake LocksExploring a Wake Lock ExamplePowerManager classRegistering Drivers with the PM DriverEarly SuspendIntroductionAndroid supports its own Powe
2012-07-19 10:40:08 749
转载 Camera
Android's camera subsystem connects the camera application to the application framework and user space libraries, which in turn communicate with the camera hardware layer that operates the physical ca
2012-07-19 10:39:19 448
转载 Audio
AudioHardwareInterface serves as the glue between proprietary audio drivers and the Android AudioFlinger service, the core audio service that handles all audio-related requests from applications.S
2012-07-19 10:37:55 497
转载 Lights
Android defines a user space C abstraction interface for LED hardware. The interface header is defined inhardware/libhardware/include/hardware/lights.h.In order to integrate LEDs with Android you ne
2012-07-19 10:36:56 497
转载 Keymaps and Keyboard Input
This document describes how keyboard input gets translated into Android actions and how you can customize key layout and key character maps to match the needs of your own device.Android uses the s
2012-07-19 10:36:15 727
转载 Display Drivers
This section describes how the display driver functions and offers a functional template designed to help you build your own device-specific driver.Android relies on the standard frame buffer device
2012-07-19 10:35:35 534
转载 Wi-Fi
Android uses wpa_supplicant as the platform interface to the Wi-Fi device. Your Wi-Fi driver must be compatible with the standard wpa_supplicant in addition to extensions added to the supplicant (spec
2012-07-19 10:34:43 419
转载 GPS
Android defines a user space C abstraction interface for GPS hardware. The interface header is defined ininclude/hardware/gps.h. In order to integate GPS with Android, you need to build a shared libra
2012-07-19 10:32:42 381
转载 Bluetooth
In this documentPortingCompilingTroubleshootingToolsFeature SupportAndroid's Bluetooth stack uses BlueZ version 3.36 for GAP, SDP, and RFCOMM profiles, and is a SIG-qualified Bluetooth 2
2012-07-19 10:31:54 926
转载 Bring Up
Once your code is built and you have verified that all necessary directories exist, power on and test your device with basic bring up, as described below. Bring up tests are typically designed to stre
2012-07-19 10:30:25 597
转载 Customization
Boot Screen CustomizationAt startup, Android displays a splashscreen image while booting the device. Do the following if you wish to modify the default splash screen:Create a 320x480 image, sp
2012-07-19 10:28:05 1818
转载 Creating Release Keys and Signing Builds
IntroductionAndroid requires that each application be signed with the developer's digital keys to enforce signature permissions and application request to use shared user ID or target process. For m
2012-07-19 10:26:22 705
转载 Build Cookbook
The Android Build Cookbook offers code snippets to help you quickly implement some common build tasks. For additional instruction, please see the other build documents in this section.Building a sim
2012-07-19 10:21:15 714
转载 Configuring a New Product
Detailed InstructionsThe steps below describe how to configure makefiles for new mobile devices and products running Android.Create a company directory in //vendor/. mkdir vendor/Create a p
2012-07-19 10:15:32 426
转载 Android Build System
Android uses a custom build system to generate tools, binaries, and documentation. This document provides an overview of Android's build system and instructions for doing a simple build.Android's
2012-07-19 10:13:21 420
转载 Android Interface Definition Language (AIDL)
AIDL (Android Interface Definition Language) is similar to other IDLs you might haveworked with. It allows you to define the programming interface that boththe client and service agree upon in order t
2012-06-30 16:08:06 677
转载 contentprovider的学习实例总结
工作中遇到了contentprovider数据共享机制,下面来总结一下:一、ContentProvider简介 当应用继承ContentProvider类,并重写该类用于提供数据和存储数据的方法,就可以向其他应用共享其数据。虽然使用其他方法也可以对外共享数据,但数据访问方式会因数据存储的方式而不同,如:采用文件方式对外共享数据,需要进行文件操作读写数据;采用sharedpr
2012-06-13 18:11:32 388
转载 C/C++调用Java代码(属性和方法)
1. JNIEnv对象 对于本地函数Java代码 JNIEXPORT void JNICALL Java_video1_TestNative_sayHello(JNIEnv * env, jobject obj){ cout"Hello Native Test !"} JNIEnv类型代表Java环境。通过这个JNIEnv*指针,就
2012-05-16 11:00:14 489
转载 如何过滤 adb logcat 输出
本文介绍如何在 shell 命令行中过滤 adb logcat 输出的几个小技巧。开发当中经常看到别人的 log 如洪水般瞬间刷满了屏幕,对自己有用的信息都被淹没了,影响心情也影响效率。下面是几个我所知道的过滤方法。1. 只显示需要的输出,白名单最方便的当然是通过管道使用 grep 过滤了,这样可以使用 grep 强大的正则表达式匹配。简单的匹配一行当中的某个字符串,例如 MyApp:
2012-05-15 11:03:13 974
转载 【翻译】Dalvik——如何控制vm
一、简介 Dalvik虚拟机支持一系列的命令行参数(使用adbshell dalvikvm –help获取列表),但是不可能通过android应用运行时来传递任意参数,但是可以通过特定的系统参数来影响虚拟机行为。 对于下述所有参数,你都可以通过setprop来设置系统特性,shell命令如下:adbshell setprop 必须
2012-04-23 14:42:45 734
转载 Android核心分析---Android电话系统
Android核心分析---Android电话系统(2012-02-21 13:05:37)转载▼标签:it分类:AndroidAndroid电话系统之概述篇 首先抛开Android的一切概念来研究一下电话系统的最基本的描述。我们的手机首先用来打电话的,随后是需要一个电话本,随后是PIM,随后是网络应用,随后是云计算,随后是想
2012-04-21 12:06:41 1046
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人