Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to set local notification in android on particular time on every week?
Forum Updated to NodeBB v4.3 + New Features

How to set local notification in android on particular time on every week?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
9 Posts 4 Posters 1.6k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    divaindie
    wrote on last edited by divaindie
    #1

    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";
    	}
    }
    
    raven-worxR 1 Reply Last reply
    0
    • D divaindie

      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";
      	}
      }
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      D 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @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.

        D Offline
        D Offline
        divaindie
        wrote on last edited by
        #3

        @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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          raven-worxR D 2 Replies Last reply
          1
          • SGaistS SGaist

            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.

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            @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? :)

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @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 :)

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • SGaistS SGaist

                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.

                D Offline
                D Offline
                divaindie
                wrote on last edited by
                #7

                @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 .

                D 1 Reply Last reply
                0
                • D divaindie

                  @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 .

                  D Offline
                  D Offline
                  divaindie
                  wrote on last edited by
                  #8

                  @divaindie error was due to "class NotificationPublisher " was not public this should be

                  public class NotificationPublisher {
                  
                  }
                  
                  Pablo J. RoginaP 1 Reply Last reply
                  0
                  • D divaindie

                    @divaindie error was due to "class NotificationPublisher " was not public this should be

                    public class NotificationPublisher {
                    
                    }
                    
                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #9

                    @divaindie glad you found it! Is your issue solved? if so please don't forget to mark your post as such. Thanks

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved