Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
This is my code for making notification and notification is showing but not playing sound please help me to identify mistakes in my code and do we need any permission to play sound,vibrate for notification?
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); AudioAttributes attributes = new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_NOTIFICATION) .build(); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); String id = "my_channel_01"; CharSequence name = "oreiomilla"; String description ="i love me"; int importance = NotificationManager.IMPORTANCE_HIGH; NotificationChannel mChannel = new NotificationChannel(id, name, importance); mChannel.setDescription(description); mChannel.enableLights(true); mChannel.setLightColor(Color.RED); mChannel .setSound(alarmSound,attributes); mChannel.enableVibration(true); mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); mNotificationManager.createNotificationChannel(mChannel); int notifyID = 1; String CHANNEL_ID = "my_channel_01"; Intent intent = new Intent(getApplicationContext(), MainActivity.class); PendingIntent pIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); Notification notification = new Notification.Builder(MainActivity.this) .setContentTitle("New Message") .setContentText("You've received new messages. "+ct) .setSmallIcon(R.drawable.ic_app_icon) .setChannelId(CHANNEL_ID) .setTicker("Showing button notification") // .addAction(android.R.drawable.ic_dialog_alert REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp
Try this it will work for you.
private void BigTextNotificationForDays(Context context, String Message, String Author) { Intent resultIntent = new Intent(context, SplashActivity.class); resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(context, (int) Calendar.getInstance().getTimeInMillis(), resultIntent, PendingIntent.FLAG_ONE_SHOT); //To set large icon in notification // Bitmap icon1 = BitmapFactory.decodeResource(getResources(), R.drawable.big_image); //Assign inbox style notification NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle(); bigText.bigText(Message); bigText.setBigContentTitle(context.getString(R.string.app_name)); bigText.setSummaryText(Author); //build notification NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context,createNotificationChannel(context)) .setSmallIcon(R.drawable.ic_notification) .setContentTitle(context.getString(R.string.app_name)) .setContentText(Message) .setStyle(bigText) .setLargeIcon(icon) .setColor(ContextCompat.getColor(context, R.color.colorPrimary)) .setVibrate(new long[]{1000, 1000}) .setSound(Settings.System.DEFAULT_NOTIFICATION_URI) .setPriority(Notification.PRIORITY_HIGH) .setAutoCancel(true) .setContentIntent(pendingIntent); //.setOngoing(true); // Gets an instance of the LocalNotificationManager service NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); //to post your notification to the notification bar mNotificationManager.notify(3730, mBuilder REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.