Android Notification not vibrating while on call -


i working on emergency messaging app in android. important part of app showing notifications new message when app in background , user not interacting app. notification requirement phone should vibrate , play notification sound when posting notification notification bar.

i have of notification part working , notifications work fine of scenarios. problem facing whenever user on call , receives notification, phone doesn't vibrate or play notification sound notification appear in notification bar.

so if user gets notification while on call cannot know notification until gets off call. whole purpose of app emergency messaging cannot afford , want app vibrate , play sound notification comes in.

the code using generating notification shown below

                int requestid = (int) system.currenttimemillis();                 pendingintent pendingintent = pendingintent.getactivity(context, requestid,notificationintent, pendingintent.flag_update_current);                 notification notification = new notificationcompat                     .builder(context)                     .setcontenttitle("title")                     .setcontenttext("text")                     .setsmallicon(r.drawable.app_icon)                     .setdefaults(notification.default_lights | notification.default_vibrate | notification.default_sound)                     .setwhen(calendar.getinstance().gettimeinmillis())                     .setcontentintent(pendingintent)                     .setautocancel(true)  //cancel notification on click                     .build();                 notificationmanager.notify(notificationid++, notification);  

this code works fine when user not on call , phone vibrates , plays notification sound incoming notification. fails when user on ongoing call.

my question that, possible third party app create notifications such vibrate , play notification sound when user on call? if yes, right way , if not best work around?

i targeting android api level 16 , above.

thank in advance.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -