Skip to content

Instantly share code, notes, and snippets.

View AhmedNawaz01's full-sized avatar
🎯
Focusing

Ahmed Nawaz AhmedNawaz01

🎯
Focusing
View GitHub Profile
@andatta
andatta / Wifi.java
Created November 21, 2020 07:05
New WiFi APIs on Android 10
public void connect(String ssid, String password) {
NetworkSpecifier networkSpecifier = new WifiNetworkSpecifier.Builder()
.setSsid(ssid)
.setWpa2Passphrase(password)
.setIsHiddenSsid(true) //specify if the network does not broadcast itself and OS must perform a forced scan in order to connect
.build();
NetworkRequest networkRequest = new NetworkRequest.Builder()
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
.setNetworkSpecifier(networkSpecifier)
.build();
import android.content.Context;
import android.content.SharedPreferences;
import com.google.gson.Gson;
import com.rogergcc.workplaycontacts.common.CommonAppUtils;
import java.lang.reflect.Type;
/**
* Singleton Class for accessing SharedPreferences,
package com.devstepbcn.wifi;
import com.facebook.react.uimanager.*;
import com.facebook.react.bridge.*;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactRootView;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.modules.core.DeviceEventManagerModule;
package io.keinix.protoflow.util;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.View;
@brucetoo
brucetoo / WifiP2PAssistant.java
Created April 27, 2018 03:23
WifiP2p helper class
package com.brucetoo.wifip2p;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.NetworkInfo;
import android.net.wifi.WpsInfo;
import android.net.wifi.p2p.WifiP2pConfig;
import android.net.wifi.p2p.WifiP2pDevice;
@PrashamTrivedi
PrashamTrivedi / DownloadRequest.kt
Last active May 28, 2024 10:50
Download File with progress indicator, written in Kotlin with Co-routines
suspend fun downloadFile(url: String,
downloadFile: File,
downloadProgressFun: (bytesRead: Long, contentLength: Long, isDone: Boolean) -> Unit) {
async(CommonPool) {
val request = with(Request.Builder()) {
url(url)
}.build()
val client = with(OkHttpClient.Builder()) {
addNetworkInterceptor { chain ->
@kiruto
kiruto / ServiceSinkhole.java
Created September 14, 2016 03:31
netguard VpnService
package eu.faircode.netguard;
/*
This file is part of NetGuard.
NetGuard is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
NetGuard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of