0

my App get a Notification when i get time Like Alarm i Just want to Run my app on Background to Can Push my Notification when time come

i was Try to Search about that Problem and ask on Many Android Groups and i Use then a Thread but Nothing work

   if (level==100){

    Thread T1 = new Thread(new Runnable() {
        @Override
        public void run() {
  // PushNotification Method
                     PushNotification();

        }
    });
    T1.start();
        }

The Code only Run when App Open but When Close the App the Code Not work

1 Answers1

-1

If you're trying to receive notifications from GCM, then create a WakefulBroadcastReceiver that can be used to receive the notification and handle it appropriately.

On the other hand, if you're trying to send a normal notification from within your app, then create your own background Service that can be used to send the notification. Here's a link to a similar SO answer that you can use for reference.

Chrisvin Jem
  • 3,940
  • 1
  • 8
  • 24