Dear Sir,
On Android 6.0 when I wanna do AlarmManager and onReceive, it is quickly found out that of the Doze mode issue, the "setRepeating" is not work but using "setExactAndAllowWhileIdle" instead ( or may use "setInexactRepeating") so that the receiving is successful. Afterwards when i call the native code function, the native code function is not work anymore and the application will be suspended.
e.g.
After
callingpublic void setScheduler(Context context) {
//.................
am.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pi);
//.................
}
Then
public void onReceive(Context context, Intent intent) {
//...............
Intent mainUIIntent = new Intent(context, MainUIStub.class);
mainUIIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mainUIIntent.putExtra(LAUNCH_BY_SCHEDULER, true);
context.startActivity(mainUIIntent);
//.................
}Then in MainUI
public void start() {
//.................
MobileNative mobileNative = (MobileNative) NativeLookup.create(MobileNative.class);
if (mobileNative.isLaunchByScheduler()) {
Form gui = stateMachine.showForm("FormMain", null);
gui.getMenuBar().removeAll();
}
//.....................
}When i call the native function "mobileNative.isLaunchByScheduler()" which is used to just return true, i can see it can go into the native function but cannot return and the application is suspend here.
Would you have any suggestion and what is the codename one response for the android 6.0 change for Doze mode issue?
Thanks and Regards,
Ronald