The basic idea of listening to the phone status on Android is to register and accept the broadcast of the phone status. The implementation is as follows:
First, you need the following permissions to listen to the phone status:
Second, accept the broadcast of phone status:
Public class phonereceiver extends broadcastreceiver {Private Static final string tag = "phonereceiver"; Public void onreceive (context, intent) {
codecorresponding to the Java code in Android, respectively.LOG.D (), LOG.I (), LOG.W (), LOG.E (), LOG.F () and other methods.4. For example[CPP]View Plaincopyprint?
#include
#include
#include
#define TAG "Myhello-jni-test"//This is the identity of the custom log
#define LOGD (...) __android_log_print (android_log_debug,tag,__va_args__)//define LOGD type
extern "C" {
Jniexport js
Suppose you want a class name such as the active print program Mainactivity.oncreate (line:37) on your Android. Method name (line) How do I sign in?1. Describes the Java thread execution stack Java.lang package that provides stacktraceelement, which can be used to get the call stack information for a method.By calling the thread function Thread.CurrentThread (). Getstacktrace () can get a stack array of sta
Adboe's red5 Streaming Media Server is free and open-source. It can be used with flash, but the use of Java and Android as client calls is a trigger.
Adobe's red5 Source Code contains an rtmpclient class, which is not complex in use, but cannot be called successfully. Observe the log and find that the connection is closed when the stream is created after the connection is successful. What I can think of is
The Log class describes:
API for sending log output. Generally, use the log.v () log.d () log.i () LOG.W () and LOG.E () methods.
The order in terms of verbosity, from least to most are ERROR, WARN, INFO, DEBUG, VERBOSE.
Verbose should never be compiled to an application except during development. Debug logs is compiled in and stripped at runtime.
Error, warning and info logs is always kept.
TIP:
Android call logs are implemented in static class Android.provider.CallLog.Calls.Permission to read and write the call log first?Readcursor cursor = context.getcontentresolver (). Query (Calllog.calls.content_uri,new string[] {CallLog.Calls.NUMBER, Calllog.calls.cached_name,calllog.calls.type,calllog.calls.date,calllog
Android handler crash log
Logs are used to easily record various exceptions of the program and facilitate the repair of program maintenance in the future. It is impossible for a program to be robust and perfect. Therefore, it is necessary to save logs in the Code for easy maintenance. The Java Thread class provides an interface UncaughtExceptionHandler, Thread. setDefaultUncaughtExceptionHandler (handler) i
Android processing program crash log, androidcrash
Logs are used to easily record various exceptions of the program and facilitate the repair of program maintenance in the future. It is impossible for a program to be robust and perfect. Therefore, it is necessary to save logs in the Code for easy maintenance. The Java Thread class provides an interface UncaughtExceptionHandler, Thread. setDefaultUncaughtExc
The stack call log that causes the program to crash writes to the file for easy collection of bugs. In Debugging the Android program, for some reason the phone can not connect to the PC side, the IDE can not see the program crashed log, I hope log can be written to the file,
1. Build the LIBGLOG.A Static library using the NDK cross-compilation chain compilation Glog under the Linux platform.2. Place the generated library file and header file in an Android project, using the Jni method call.3. The compilation encountered the error "stderr, stdout undefined", (see here N many documents, seemingly Android platform will stderr, and stdou
Android: Call the system sharing Function
Sample Code:
/*** Call the system sharing Function * Created by admin on 15-4-13. */public class extends Activity {@ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. pai_layout);} // share the text public void shareText (View view) {Intent = ne
Android applications have a large number of ANR or crash events, except for the applications you have developed, we can find a way to transmit the crashed log information to the server, then it involves how to get the error information of our application. But remember to filter the log information. You only need to retrieve the
Log statistics using AOP for Aspect-Oriented Programming on the Android platformRecently, I have thought of aop because I need to collect some app logs and don't want to call them everywhere. The procedure is as follows:1. Install the ajdt plug-in eclipse2. Set the cut point and implement the cut point execution method. The configuration in
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.