Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. AudioManager audioManager = (AudioManager) getContext().getSystemService(AUDIO_SERVICE);
  2. audioManager.setMode(AudioManager.ROUTE_EARPIECE);
  3. audioManager.setSpeakerphoneOn(false);
  4.  
  5. NotificationCompat.Builder mBuilder =
  6. new NotificationCompat.Builder(context)
  7. .setSmallIcon(R.drawable.newlogo)
  8. .setLargeIcon(largeIcon)
  9. .setSound(uri)
  10. .setContentTitle(notificationHeading)
  11. .setContentText(notificationBody)
  12. .setPriority(Notification.PRIORITY_HIGH).setVibrate(v);
  13. notificationManager.notify(1,mBuilder.build());
  14.  
  15. AUDIO_STREAM_ENFORCED_AUDIBLE = 7, /* Sounds that cannot be muted by user
  16. * and must be routed to speaker
  17. */
  18. AUDIO_STREAM_TTS = 9, /* Transmitted Through Speaker.
  19. * Plays over speaker only, silent on other devices.
  20. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement