Trouble getting AlarmManager to work with JNI. BroadcastReceiver.onReceive not called

I’ve been trying to get this working for a few days now and I feel like I’m not experienced enough with JNI to understand what’s going wrong. When I set my AlarmManager, my reciever is never called.

Others have had problems integrating AlarmManager into cocos2d-x as well:

https://discuss.cocos2d-x.org/t/android-create-a-alarmmanager-in-appactivity/16253/7

I have tried using this sample code as a guide for writing my own, but I think it’s a bit out of date and still uses NativeActivity.

Has anyone managed to get AlarmManager to work with a recent version of cocos?

Hi @cpp1073,

I didn’t test the code, but in line 54 of the Activity, is a set call. The problem could be a change in the AlarmManager behavior with Android KitKat (I believe). Change set with setExact and it should be working.

It would be nice, to get feedback if this change work.

That was a painfully simple solution! Thanks, android development can certainly be cumbersome at times.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.