Skip to content

Instantly share code, notes, and snippets.

View AafaaqAli's full-sized avatar
🎯
Focusing

Aafaq Ali AafaaqAli

🎯
Focusing
View GitHub Profile
For Remove Hardware features check following files in android source :
1. Check the device.mk file for your device(Like : device/<vendor>/<device>.mk)
2. Check the common.mk file for your device(Like : device/<vendor>/common/common.mk)
There both files is probably a line like the following:
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
@AafaaqAli
AafaaqAli / AndroidDeviceEnrollmentQRCreation.md
Created June 13, 2024 13:15 — forked from bashenk/AndroidDeviceEnrollmentQRCreation.md
Creating a QR Code for Android Device Enrollment
@AafaaqAli
AafaaqAli / Camera2.md
Created October 20, 2022 07:49 — forked from Tanapruk/Camera2.md
Camera2 API

TextureView

You need to initialize TextureView before opening a camera. TextureView is for displaying the image from camera on the device. However, you cannot use it unless the texture is ready, either because the screen is currently off or it is initializing.

You should check mTextureView.isAvailable() before opening your camera. Else you will mTextureView.setSurfaceTextureListener(). And open your camera in the callback method onSurfaceTextureListener.

Camera

Before opening your camera you should check for a camera permission first.

{ "JTT" : [
{ "track" : {
"title" : "Test Activity",
"desc" : "Simple test activity walking around the block with a heart rate monitor, stopping once, and marking one lap. Recorded with Garmin Fenix 3, uploaded to Garmin Connect, and exported as GPX and TCX. Both exports are crippled because they do not contain all data fields of the activity.",
"segments" : [
{ "data-fields" : ["latitude", "longitude", "elevation", "temperature", "HR" ] },
[
[ 47.407614681869745, 8.553115781396627, 451.79998779296875, "2015-11-13T12:57:24.000Z", 28.0, 76],
[ 47.40762138739228, 8.553108656778932, 451.0, "2015-11-13T12:57:25.000Z", 28.0, 76],
[ 47.407626835629344, 8.553094072267413, 450.0, "2015-11-13T12:57:26.000Z", 28.0, 76],
@AafaaqAli
AafaaqAli / backupAndroidDevice.sh
Created January 30, 2022 17:10 — forked from gema-arta/backupAndroidDevice.sh
A simple script to backup my Android phone to my Macbook.
#!/bin/bash
#
# backupAndroidDevice.sh
#
# A simple script to backup my Android phone to my Macbook.
#
# Syntax: backupAndroidDevice.sh output_folder
# output folder must exist
#
# Requirements/assumptions:
@AafaaqAli
AafaaqAli / AdbCommands
Created January 30, 2022 16:59 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@AafaaqAli
AafaaqAli / ConnectivityExtension.kt
Created October 10, 2021 12:58 — forked from alana-mullen/ConnectivityExtension.kt
Android Kotlin extension to check network connectivity
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.os.Build
val Context.isConnected: Boolean
get() {
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
return when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> {
@AafaaqAli
AafaaqAli / Data.kt
Created July 6, 2021 16:53 — forked from florina-muntenescu/Data.kt
Using RoomDatabase#Callback to pre-populate the database - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@AafaaqAli
AafaaqAli / gist:d2d51459c1f96ebbea5a526d22c81b74
Created June 30, 2021 08:44 — forked from JBirdVegas/gist:3874450
ContentObserver quick example
// references internal ContentObserver class
SettingsObserver observer = new SettingsObserver(new Handler());
// start watching for changes
observer.observe();
// where we do our work
updateSettings();
// Anonymous inner class to handle watching Uris
class SettingsObserver extends ContentObserver {
SettingsObserver(Handler handler) {