我在这里寻找类似的问题,但由于某种原因,我的BroadcastReceiver永远不会收到android.intent.action.BOOT_COMPLETED Intent.
这是我的(相对)Android.Manifest文件:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
<receiver android:name=".BootReceiver"
android:enabled="true"
android:exported="true"
android:label="BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
这是实际的接收器.
public class BootReceiver extends BroadcastReceiver {
private static final String TAG="BootReceiver";
@Override public void onReceive(Context context,Intent intent){
try{
context.startService(new Intent(context,ConnectivityListener.class));
Log.i(TAG,"Starting Service ConnectivityListener");
}catch(Exception e){
Log.e(TAG,e.toString());
}
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢!任何帮助是极大的赞赏
我定义了以下结构
typedef struct {
uint16_t type;
uint16_t name_offset;
uint32_t data_offset;
uint32_t size;
}node;
Run Code Online (Sandbox Code Playgroud)
sizeof(node) 按预期返回12个字节.
node *nodes = (node*)malloc(sizeof(node)*nodecount);
Run Code Online (Sandbox Code Playgroud)
在我当前的测试中,nodecount是96,并且为节点分配的内存是预期的1152.(通过_msize测试)
我想从我在偏移量为20的缓冲区memcpy进入这个新节点数组(这是我崩溃的地方).我已经确认0x20(含)-0x4A0(不包括)是这个数组的正确结构.
memcpy(nodes,buffer[0x20],sizeof(node)*nodecount)
Run Code Online (Sandbox Code Playgroud)
缓冲区看起来像这样
00000020: 01 00 00 00 00 00 00 00 00 00 00 60
...
00000490: 00 00 00 88 00 00 06 89 02 15 DE 40
Run Code Online (Sandbox Code Playgroud)