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)
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 channel = NotificationChannel(
channelId,
channelName,
NotificationManager.IMPORTANCE_DEFAULT
)
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:

Exploring GraphQL on Android

Description

Traditionally most of us have been using REST for our APIs. Even though it has worked well till now, there are multiple pain points around it like too many endpoints, payload bloat, documentation effort etc. Then came GraphQL to save us developers. GraphQL is a query language for APIs.

In this talk, we explore the general pain points regarding REST and understand how GraphQL addresses them. We also go through the process of consuming GraphQL APIs on Android and common things to keep in mind. With Apollo for Android reaching v1.0 recently, now is the perfect time to explore GraphQL on Android.

Elevator pitch

As a mobile developer working with REST APIs, you must have at one point wished that you didn't have to hit different endpoints just for slightly different data. GraphQL was built to address this and many other pain points. Come learn about this new query language and how you can try it on Android.