Hello, *I'm a CodeNameOne beginner.* I'm trying to make a local notification, it doesn't seem to work, here's the full main class. Is there anything missing? Can there be any explanatory video so I can proceed to run it? I need this to be working in 2 days. Any help is appreciated.
Best regards. package com.mycompany.myapp; import static com.codename1.ui.CN.*; import com.codename1.ui.Display; import com.codename1.ui.Form; import com.codename1.ui.Dialog; import com.codename1.ui.Label; import com.codename1.ui.plaf.UIManager; import com.codename1.ui.util.Resources; import com.codename1.io.Log; import com.codename1.ui.Toolbar; import java.io.IOException; import com.codename1.ui.layouts.BoxLayout; import com.codename1.io.NetworkEvent; import com.codename1.notifications.LocalNotification; /** * This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose * of building native mobile applications using Java. */ public class MyApplication { private Form current; private Resources theme; public void init(Object context) { // use two network threads instead of one updateNetworkThreadCount(2); theme = UIManager.initFirstTheme("/theme"); // Enable Toolbar on all Forms by default Toolbar.setGlobalToolbar(true); // Pro only feature Log.bindCrashProtection(true); addNetworkErrorListener(err -> { // prevent the event from propagating err.consume(); if(err.getError() != null) { Log.e(err.getError()); } Log.sendLogAsync(); Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null); }); } public void start() { if(current != null){ current.show(); return; } Form hi = new Form("Hi World", BoxLayout.y()); hi.add(new Label("Hi World")); hi.show(); LocalNotification n = new LocalNotification(); n.setId("demo-notification"); n.setAlertBody("It's time to take a break and look at me"); n.setAlertTitle("Break Time!"); //n.setAlertSound("/notification_sound_beep-01a.mp3"); // alert sound file name must begin with notification_sound Display.getInstance().scheduleLocalNotification( n, System.currentTimeMillis() + 10 * 1000, // fire date/time LocalNotification.REPEAT_MINUTE // Whether to repeat and what frequency ); } public void stop() { current = getCurrentForm(); if(current instanceof Dialog) { ((Dialog)current).dispose(); current = getCurrentForm(); } } public void destroy() { } } -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/d0c9f00f-4a6a-4b24-9304-17840371b24bn%40googlegroups.com.
