android - adding function into notification -
hello guys question pretty basic since noob in android development have ask , want add action inside notification , done using code
notification.addaction(r.mipmap.ic_launcher, "decrease", pendingintent);
but can see added pendingintent
in parameter , intent
passing me particular activity (what supposed so) instead of passing user activity want perform action without opening app how can ?? , action increasing countervalue performing counter++
pending intent can used intent, without such ability run piece of code. can use dummy activity opened on notification click , exits after doing jobs.
however, using activities can annoying users flashes in , out on screen. might want use services not interrupt users , job simultaneously.
in case intentservice seems fit can used ease.
android document nicely describes service's lifecycle , methods of it's worth try.
Comments
Post a Comment