我这边在启动service的时候,报了一句
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
最后发现是content出错了
定义后不能空着,在create或start中要赋值
@Override
public void onCreate() {
super.onCreate();
context = CallRecordService.this;
share.CreateFileWrite("CallRecordService:onCreate");
}
要是在service中发送广播什么的就直接调用再不要用content.sendBroadcast(intent);
而是直接sendBroadcast(intent);问题解决