Skip to content

Instantly share code, notes, and snippets.

View SubhrajyotiSen's full-sized avatar

Subhrajyoti Sen SubhrajyotiSen

View GitHub Profile
@Nullable
public NotificationChannelCompat getNotificationChannelCompat(@NonNull String channelId) {
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel channel = getNotificationChannel(channelId);
if (channel != null) {
return new NotificationChannelCompat(channel);
}
}
return null;
}
val notificationManager: NotificationManagerCompat =
NotificationManagerCompat.from(context)
val channel: NotificationChannelCompat? =
notificationManager.getNotificationChannelCompat(channelId)
val channel = NotificationChannel(
channelId,
channelName,
NotificationManager.IMPORTANCE_DEFAULT
)
manager.createNotificationChannel(channel)
public void createNotificationChannel(@NonNull NotificationChannel channel) {
if (Build.VERSION.SDK_INT >= 26) {
mNotificationManager.createNotificationChannel(channel);
}
}
val channel = NotificationChannelCompat.Builder(
channelId,
NotificationManagerCompat.IMPORTANCE_DEFAULT
).setName(channelName)
.build()
// manager is of type NotificationManagerCompat
manager.createNotificationChannel(channel)
val notificationManager = NotificationManagerCompat.from(context)
// internally it does the following
public static NotificationManagerCompat from(@NonNull Context context) {
return new NotificationManagerCompat(context);
}
private NotificationManagerCompat(Context context) {
mContext = context;
val manager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
channelId,
channelName,
NotificationManager.IMPORTANCE_DEFAULT
)
manager.createNotificationChannel(channel)
}
from bs4 import BeautifulSoup
import requests
import urllib3
def main():
url = "https://rptechindia.in/nvidia-geforce-rtx-3070.html"
hdr = {'User-Agent':
('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 '
'(KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'),

Keybase proof

I hereby claim:

  • I am subhrajyotisen on github.
  • I am subhrajyotisen (https://keybase.io/subhrajyotisen) on keybase.
  • I have a public key ASDX5xLppPR5GLJO6x-_jhZPFlAh7K2Qi-H9D1IEpMO3cgo

To claim this, I am signing this object:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="SubhrajyotiSen/private_whyred" path="device/xiaomi/whyred" remote="private" revision="audio" />
<project
name= "SubhrajyotiSen/whyred"
path= "kernel/xiaomi/whyred"
remote="github" revision="pie" />
<project
name= "LineageOS/android_packages_resources_devicesettings"