Pages

Tuesday, March 1, 2022

KeyPoints-Series-1

 The Android architecture has the Main Thread AKA UI thread, which updates the UI after every 16ms frame. 

PlayStore Background Location Approval

 Google approve your app once the permission declaration form is signed and submitted to the play store Here you will need to answer the following questions.



1.Permission Declaration Form 

    You can find the permission decalrion form via app content in  playstore dashboard . 

Once you get there you will need to answer following questions 


1- what is the core purpose of your app?

2- Why does your app need to aceess location in the background?

3-  Here you need to describe the main Feature that requires background location access if you have more than one feature choose one that provides the most value to the user 

4- Describe the detail why background location access is needed instead of foreground

5- Video Submission


It can be an Inn App Disclosure that states why we use background location and has onclick method to enable location rightaway


 Example Text For Disclosure 


    This app uses location feature for building an accurate daily journey

 and uses other feature of geospark like trips insights geofences and events 

.\Please enable the location Permission






Monday, January 17, 2022

Handlers and Threads In Android Studio

 When a user opens an application android operating system creates a process or a thread of execution of commands called the main Thread or the ui thread . The  main thread is nothing but handler thread .The main thread is responsible for handling events from all over the apps . Any piece of java code is that needs to be exwcuted are pushed and serviced by the Main Thread .The main is thread is doing most of the stuff so its better to use multiple thread other than the ui thread or main thread. 


A thread is the path followed when  executing a program .The jvm allows and application to have multiple threads of execution running parralell . So multple path of programs can executed in paraalel .so as to bring the results or returns of methods to the Main Thread


We can perform any task in multiple threads but as far as  Updating the userinteface or anything updating the main thread is concerned we cant do it unless we have handlers in that thread that will tell the Main Thread about the updates or data .



A video will be uploaded soon with the attachment 



Wednesday, January 12, 2022

Broadcast In Android

 Broadcast Are such classes in android by which data can be transferred bwetween several app also some triggers can be developed to execute some functions. 

For Example 

        We can run our own methods when an android phone starts or whenever there is incoming call acutually we can say they are triggers for a code to be executed when a specified intent is alive inside the android operating system  

<intent-filter>
         <action android:name="android.intent.action.BOOT_COMPLETED">
         </action>
      </intent-filter>

the above intent can be declared in MANIFEST File and A broadcast Reciever onRecieve Method is executed whenever this intent is recieved 

CUSTOM INTENTS IN ANDROID

you can create custombroadcast intent tha twhen on recieve will execute functions
public void broadcastIntent(View view){
      Intent intent = new Intent();
      intent.setAction("com.tutorialspoint.CUSTOM_INTENT"); sendBroadcast(intent);
   }
Include above code in your mainactivity on a button click this will send a broadcast intent and can be recieve via create reciever and declaring in manifest 


Wednesday, December 8, 2021

How to create csv file in android studio ||csv file in java language via filewriter

 package com.mafaz.csvcreatefile;


import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.Environment;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
File folder = new File(Environment.getExternalStorageDirectory()+"/sensordata.csv");
//String location = "/InternalStrorage/newCsvFile.csv";
generateCsvFile(folder.toString());


}
private static void generateCsvFile(String fileName) {

FileWriter writer = null;

try {

writer = new FileWriter(fileName);
writer.append("Name");
writer.append(',');
writer.append("Number");
writer.append('\n');

writer.append("interview questions");
writer.append(',');
writer.append("001");
writer.append('\n');

writer.append("interview programs");
writer.append(',');
writer.append("004");
writer.append('\n');

System.out.println("CSV file is created...");

} catch (IOException e) {
e.printStackTrace();
} finally {
try {
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}



}


<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Friday, December 3, 2021

How to Create Background Services in Android Studio

 Services in Android 


FOREGROUND : Runs even if app is killed displays notification while running

BACKGROUND : Run like foreground without notification

BOUND :  Bounded to component . alive till component is alive\



Github: https://github.com/OwaisBukhari/BackgroundServices

Youtube: https://youtu.be/D0QxMBjcfl0


Monday, November 15, 2021

Fetch Folder name in php

 <?php


    $path ="indus-img";
    $contents = scandir($path);


    $new_src=$contents[2];
    $count=count($contents);
    echo $new_src;
    echo $count;
 


?>

Fetch Json Data in JAVASCRIPT

 <script>

    fetch('./data.json')
    .then(function(resp){
        return resp.json();
    })
        .then(function(data){
        console.log(data.items[p].name.substr(7));
        content=data.items[p].name.substr(7)


        

    });
  

</script>

Friday, November 12, 2021

Google Sheets Create Json Api

function doGet(e) {
  var sheet = SpreadsheetApp.getActive();
  var nse = sheet.getSheetByName("NSEE");
  var data =[];
  var rlen=nse.getLastRow();
  var clen=nse.getLastColumn();
  var rows = nse.getRange(1,1,rlen,clen).getValues();
  for(var i=1;i<rows.length;i++ ){
    var datarowrows[i];
    var record ={};
    for (var j=0;j<clen;j++){
      record[rows[0][j]] = datarow[j];

    }
    data.push(record);
  }
  console.log(data);
  var result = JSON.stringify(data);
  return ContentService.createTextOutput(result).setMimeType(ContentService.MimeType.JSON);
  
 }

Tuesday, July 20, 2021

Fused locations api in android studio

In order to acces the device location one can go networkprovided location or gps provided location . fused location provider api enables us to use location whenever we desires with less use of power consumption .and it enables us to get the best location of the meanwhile . it normally uses the last known location used by amy app in the devices and display it to the user 

Friday, July 16, 2021

Python apps and native Android programming

 ✅✅✅ Yes we can make android apps with python with a verygood design .although there are some limitations also which one can easily do with native programming . Like for say using the android hardwares amd sensor sometimes it becomes difficult than what we can easily do with java or kotlin … the platform mostly used is kivy for python programmed android apps

✅✅✅ Hope you find it to be useful Feel free to ask anything

KeyPoints-Series-1

  The Android architecture has the Main Thread AKA UI thread, which updates the UI after every  16ms  frame.