How to set local notification in android on particular time on every week?
-
Hi All,
In my Android application i want to send notification every week at particular Time when notication button is set by the user.
I have built cpp class which takes care of which time and day notification should be set and what string it should show in notifciation .my problem is iam not able write java class which can actually do this task.example :
below is my qml code ,where notify is a object which is a cpp class,basicall below line will call setNotifcationString(), notificationDay() and setNotifcationTime() functions of cpp class.
after setting which string to show, day and Time i need to call a java method which can take care of setting notofication every week on monday at 7.30AM .
iam not able to figure out what i need to implement in java class .please give me a java class code which can do the same .ToolButton { id:notifyButton onClicked :{ notify.notification="wake up call"; notify.notificationDay = "Monday"; notify.notificationTime = "7.30AM"; } }
-
@divaindie
notifications are normally triggered by the "cloud". That means you need a service which publishes a notification via the corresponding service framework.
If you just want to operate locally, you need to implement a background service and trigger the notification when needed. -
@raven-worx i want to operate locally ,i was not able to write java class which would schedule a notification for particular time in every week.i was wandering if anyone can give me a sample code of java .that will be helpful
-
Hi,
@raven-worx notifications come in two flavours: local and push. Only the second one needs external resources.
@divaindie this stack overflow question looks like a good starting point.
-
@SGaist said in How to set push notification in android on particular time on every week?:
@raven-worx notifications come in two flavours: local and push. Only the second one needs external resources.
thats what i wrote? :)
-
@raven-worx said in How to set push notification in android on particular time on every week?:
@SGaist said in How to set push notification in android on particular time on every week?:
@raven-worx notifications come in two flavours: local and push. Only the second one needs external resources.
thats what i wrote? :)
My bad, I misread the last section !
My point was that there are services on both iOS and Android that provides notifications. No need to re-implement the wheel in an application :)
-
@SGaist i tried answer from the stackoverflow link ,but getting below error
D AndroidRuntime: Shutting down VM
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: org.qtproject.example, PID: 15505
E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate receiver com.lasconic.NotificationPublisher: java.lang.IllegalAccessException: java.lang.Class<com.lasconic.NotificationPublisher> is not accessible from java.lang.Class<android.app.ActivityThread>
E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3171)
E AndroidRuntime: at android.app.ActivityThread.-wrap17(Unknown Source:0)
E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6494)
E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E AndroidRuntime: Caused by: java.lang.IllegalAccessException: java.lang.Class<com.lasconic.NotificationPublisher> is not accessible from java.lang.Class<android.app.ActivityThread>iam not able to figure out the solution ,if possible please help me with this .
-
@divaindie glad you found it! Is your issue solved? if so please don't forget to mark your post as such. Thanks