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 calling

public 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

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/cc1c5177-23b6-4f05-8604-a2c3fb9afd2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to