Someone answered, but for some reason the answer disappeared, otherwise I would have accepted it.
The answer basically went that
pending_intent = createPendingResult(PENDING_INTENT_ID, new Intent(), 0);
is not reliable, and suggested using broadcast receivers instead. I still do not know why they aren't working (I commented on the answer asking if they knew anything more), but anyway. I wrote
broadcastReceiver = new AlertBroadcastReceiver(this);
registerReceiver(broadcastReceiver, new IntentFilter("SomeAction"));
and added a broadcast receiver to handle this, and this works.