Skip to content

Instantly share code, notes, and snippets.

View tauheed0007's full-sized avatar
🎯
Focusing

M Tauheed Ali tauheed0007

🎯
Focusing
View GitHub Profile
public void checkGPS() {
locationRequest = LocationRequest.create();
locationRequest.setInterval(1000);
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
.addLocationRequest(locationRequest)
.setAlwaysShow(true);
Task<LocationSettingsResponse> locationSettingsResponseTask = LocationServices.getSettingsClient(getApplicationContext())
.checkLocationSettings(builder.build());
@tauheed0007
tauheed0007 / PostData.java
Created April 11, 2022 07:44
method to post data in Google sheet
package com.example.androidtogooglesheetdatabase.Post;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
@tauheed0007
tauheed0007 / Code.gs
Created April 11, 2022 07:42
Google script app for Post data from android app to Google Sheet
function doGet(e) {
handleFunction(e);
}
function doPost(e) {
handleFunction(e);
@tauheed0007
tauheed0007 / toggle_with_three_icons.dart
Created March 31, 2022 10:56
This is how we can use 3 toggle buttons with 3 icons
ToggleButtons(
children: <Widget>[
Icon(Icons.ac_unit),
Icon(Icons.call),
Icon(Icons.cake),
],
onPressed: (int index) {
setState(() {
isSelected[index] = !isSelected[index];
});
@tauheed0007
tauheed0007 / http_request_permission.dart
Created March 29, 2022 09:36
by this method we can easily get data from api because now we also have to parse the link with Uri
import 'package:http/http.dart';.
//dependency
http: ^0.13.4
void getData() async {
//var url = Uri.parse("https://samples.openweathermap.org/data/2.5/weather?q=London&mode=html&appid=b6907d289e10d714a6e88b30761fae22");
// http.Response response = await http.get(url);
@tauheed0007
tauheed0007 / location_permission_update_method.dart
Last active April 29, 2022 19:45
this is latest method to access location with geolocator dependency to find location and its the error free version of londonappbrewery Angela method
//import
import 'package:geolocator/geolocator.dart';
//dependency
geolocator: ^8.2.0
//manifest file under direct tag of applicatioon after android 10 it is necessary to use background location
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />