序列化问题两例

序列化问题一:PendingIntent 6.0以后无法携带序列化对象
有混合传序列化对象 都会有问题


test(1541726712000l);
private void test(long time) {

    Intent intent = getaIntent();

    PendingIntent pending = PendingIntent.getBroadcast(ContextProvider.getApplicationContext(),
            111,
            intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    AlarmManager manager = (AlarmManager) (ContextProvider.getApplicationContext()).getSystemService(Context.ALARM_SERVICE);
    if (Build.VERSION.SDK_INT >= 19) { //API19以上使用才会准确时间传递
        manager.setExact(AlarmManager.RTC, time, pending);
    } else {
        manager.set(AlarmManager.RTC, time, pending);
    }
    Log.i("info","set:"+time);
}


private Intent getaIntent() {
    Intent intent = new Intent(ContextProvider.getApplicationContext(), AlarmReceiver.class);
  TagModel model=new  TagModel ();
    model.setTagId("1111");
    model.setChannelName("eeeeee");
    intent.putExtra("data","dataaaa");
    intent.putExtra("url", (Serializable) model);
    intent.putExtra("time","ddddd");
    intent.putExtra("jumpKindValue", "jumpKindValueqqq");
    intent.putExtra("action", "show_outside_message");
    return intent;
}

序列化问题:

fastjson序列化内部类对象时,关于序列化内部类时:内部类一定是static内部类,且字段为public,否则不能序列化数据到内部类字段上。

https://blog.csdn.net/mynamepg/article/details/80251626

你可能感兴趣的:(序列化问题两例)