Thursday, December 31, 2015

Android Studio IDE, Software Updates, AS05 - Kapil Sharma

                                                     https://youtu.be/rskjvc6NcMA


Friday, October 09, 2015

Google Location Services API - Kapil Sharma

Google Location Services API:  

Author(Danny) - http://goo.gl/d55bpz

Package “android.location”

The package “android.location” has been available since Android was first introduced, and it gives us access to location services. These services allow applications to obtain periodic updates of the device’s geographical location.
The package provides two means of acquiring location data:
  • LocationManager.GPS_PROVIDER: Determines location using satellites. Depending on the conditions, this provider may take a while to return a location fix.
  • LocationManager.NETWORK_PROVIDER: Determines location based on availability of nearby cell towers and WiFi access points. This is faster than GPS_PROVIDER.
When you are looking for user location you have to play with these providers and their availability. Ideally you obtain the first location using NETWORK_PROVIDER, which might not be as accurate, but is much faster. You might then make an attempt to increase accuracy by listening for a better location fix using the GPS_PROVIDER.

Google Location Services API

Google Location Services API, also known as FusedLocationProviderApi, is Google’s recommended way of getting a user’s location. It provides the best accuracy based on our needs. Some of the advantages of using this API over the previous one are:
  • Simplicity: Unlike the previous API, you no longer have to deal with multiple providers. Instead, you specify high-level needs, such as “high accuracy” or “low power”, and it will take a suitable approach.
  • Availability: Gives your app immediate access to the best, most recent known location. Usually this information is readily available, you just have to ask for it.
  • Power-efficiency: Minimizes your application’s usage of power.
  • Versatility: Meets a wide range of needs, from foreground uses - needing highly accurate location data, to background uses - requiring only periodic location updates with negligible power impact.

    Requesting Permission, Configuring AndroidManifest.xml
    Androids have specific security features that would prevent any arbitrary application from requesting a precise user location. To solve this, we need to edit “AndroidManifest.xml” and add the permission we require for this application:

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    
    While we are at it, we should also define the version of Google Play Services we are using for this application:
    <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />
    

    Checking for Google Play Services Availability: 

    Before accessing features provided by Google Play Services, we must check if the device has Google Play Services installed, and that the version is the one we intend to use (6.5.87).

    private boolean checkGooglePlayServices(){
     int checkGooglePlayServices = GooglePlayServicesUtil
      .isGooglePlayServicesAvailable(mContext);
     if (checkGooglePlayServices != ConnectionResult.SUCCESS) {
      /*
      * Google Play Services is missing or update is required
      *  return code could be
      * SUCCESS,
      * SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED,
      * SERVICE_DISABLED, SERVICE_INVALID.
      */
      GooglePlayServicesUtil.getErrorDialog(checkGooglePlayServices,
      mContext, REQUEST_CODE_RECOVER_PLAY_SERVICES).show();
    
      return false;
     }
    
     return true;
    }
    
    This method will check for Google Play Services, and in case the device doesn’t have it installed (it’s rare, but I’ve seen such cases), it will open a dialog with the corresponding error and invite the user to install/update Google Play Services from the Google Play Store.

    Accessing Google APIs

    To access Google APIs, we just need to perform one more step: create an instance of GoogleApiClient. The Google API Client provides a common entry point to all the Google Play services, and manages the network connection between the user’s device and each Google service.
    Github Source: https://github.com/dtrejogo/google-location-services-api

Tuesday, August 18, 2015

Android Marshmallow - Kapil Sharma




New: API 23
  • Android Platform Change:
    • Final Permissions User Interface — we updated the permissions user interface and enhanced some of the permissions behavior.
  • API Change:
    • Updates to the Fingerprint API — which enables better error reporting, better fingerprint enrollment experience, plus enumeration support for greater reliability.

http://android-developers.blogspot.in/2015/08/m-developer-preview-3-final-sdk.html

Developer Preview 3
Build: MPA44G
Hardware support: Nexus 5, 6, 9, Player
Emulator support: x86 & ARM 32/64-bit
Google Play services: 7.8

Key Changes: Permission changes


Install an Image to a Device: 

In order to use a device image for testing, you must install it on a compatible device. Follow the instructions below to install a system image:
  1. Download and uncompress one of the system image packages listed here.
  2. Backup any data you want to preserve from the device.
  3. Follow the instructions at developers.google.com/android to flash the image onto your device.
Android M Preview 3 Developer Docs: 

Saturday, April 04, 2015

Android OxygenOS - Kapil Sharma

OxygenOSAndroid Lollipop 5.1




Pre-requisite: Backed up all your smart phone data. 

Install 'Fastboot and ADB' on your Windows PC. 


Step 1: First flash your smartphone with recovery software. Download and save the TWRP file from here.


Step 2: Enable ADB Debugging mode on your smartphone. 

Click on Settings -> Developer options and enable ADB Debugging.  

Step 3: Switch off the phone. Enter Fastboot mode. You can do this on your OnePlus One by holding down the power button and the volume up button. When you see the fastboot logo, connect your device to your computer.


Step 4: Now on your Windows PC, start Command Prompt. In the CMD terminal, head to the folder where you have saved the TWRP recovery file you downloaded earlier.


Step 5: Type the commands as given below:  


fastboot oem unlock 

(You can skip this step if your phone’s bootloader is already unlocked).
fastboot flash recovery img
>. Image file should be the TWRP recovery image.
fastboot reboot

Step 6: Now your smartphone should reboot. Keep the smartphone connected to the machine.


Step 7: Head to the folder where you downloaded the OxygenOS file on your PC. You should see the file name oxygenos_1.0.0.zip. Unzip the file and you should be able to see the oxygenos_1.0.0.flashable.zip file being released.


Step 8: Copy oxygenos_1.0.0.flashable.zip to your phone’s internal storage.


Step 9: Once copied, detach the smartphone from the PC. Shut down the phone.


Step 10: Enter the recovery mode on your device. You can do this on your smartphone by holding down both the volume down key and the power button.


Step 11: Once you are in the recovery interface, the first thing you want to do is a factory reset. Again, you will lose all your data so please make sure you have backed up data before doing this.


Step 12: After the wipe, go to install and find oxygenos_1.0.0.flashable.zip. Confirm the flash. This will flash OxygenOS onto your smartphone.



Known Issues:
Files sometimes crash when uploading files to the cloud.
When printing images, printer service may stop.
Cannot hang up a call using headphone controls. (intermittent)
During system update, display of Wi-Fi/data notification may be incorrect.
OTG can only recognize FAT32 file system.
During system update, display of version number may be incorrect.
Files does not support multi-select deletes.
Files may crash when renaming image files