java - How to send a notification to android wear every minute -


i tried making app sends custom notification android wear, part worked wanted implement service app send notification every minute. missing something,can guys me please? lot! error points "this", new android programming, don't know how solve this.

public class mainactivity extends activity {  public class notifservice extends service {     scheduledexecutorservice scheduler = executors.newsinglethreadscheduledexecutor();      public ibinder onbind(intent arg0) {         return null;     }       public void onstart(intent intent, int startid) {         super.onstart(intent, startid);         final intent intent1 = new intent(this, notifservice.class);          scheduler.schedulewithfixeddelay(new runnable() {             @override             public void run() {                 setcontentview(r.layout.activity_main);                 //create pendingintent                 pendingintent pendingintent = pendingintent.getactivity(this, 0, intent1, pendingintent.flag_update_current);                 //create notification action                 notificationcompat.action action = new notificationcompat.action.builder(                         r.mipmap.app_icon, getstring(r.string.weartitle), pendingintent).build();                 //create notification                 notification notification = new notificationcompat.builder(this)                         .setcontenttext(getstring(r.string.content))                         .setcontenttitle(getstring(r.string.title))                         .setsmallicon((r.mipmap.app_icon))                         .extend(new notificationcompat.wearableextender().addaction(action))                         .build();                 //create notification manager                 notificationmanagercompat notificationmanagercompat = notificationmanagercompat.from(this);                 notificationmanagercompat.notify(001, notification);             }         }, 60, 60, timeunit.seconds); 


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -