Git Product home page Git Product logo

background-location-updates-android-o's Introduction

Codelab for learning about changes to background location gathering in Android "O".

Apps running on "O" devices have significant limits placed on background location gathering. These limits apply regardless of the targetSdkVersion specified in build.gradle. This codelab shows how to work with these new limits.

background-location-updates-android-o's People

Contributors

nageshs avatar shailen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

background-location-updates-android-o's Issues

Old platform versions are used

Old platform versions are used. An update would be great.
e.g. improved build.gradle.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.google.android.gms.location.sample.backgroundlocationupdates"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.1.0'
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:design:26.1.0'
    compile 'com.google.android.gms:play-services-location:11.8.0'
}

Google Code Labs: Background Location Updates in Android "O" ClassNotFoundException

The Background Location Updates in Android "O" code lab has a minSdkVersion of 16 but the source code uses a number of API features that are, for example, only available in SDK 24 and 26. This results in the application halting with ClassNotFoundException when run on any device < SDK 26.
The solution is to set minSdkVersion to 26.

LocationResultHelper(Context context, List<Location> locations) {
    mContext = context;
    mLocations = locations;

                                                                       API 26
    NotificationChannel channel = new NotificationChannel(PRIMARY_CHANNEL,
                                                                                                    API 24
            context.getString(R.string.default_channel), NotificationManager.IMPORTANCE_DEFAULT);
                           API 26        
    channel.setLightColor(Color.GREEN);
                           API 26
    channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
                                                             API 26
    getNotificationManager().createNotificationChannel(channel);
}

System UI Crashed

I tried to test this Demo in ONE PLUS 3T Version and It crashed my phone (Not app only but main sytem UI app Stopped and device stared blinking). I triple check all code and everything was same so please check it with Once with One Plus 3T android O version.

setMaxWaitTime is no longer working

Hello,

Greatly appreciate this code!, working super fine in background. But the setMaxWaitTime is so frequent and only works if i set to 10 milliseconds, anything more than that it doesn't take it.

Please have a look at it.
Thanks,
Raj

FusedLocation Api is Deprecated

Hi Team,

First of all I would like to appreciate the team efforts been made for developing this code lab.

After reading the Android Official Documentation what I found is the codelab is using FusedLocationApi to get location updates which is now deprecated and been replaced by FusedLocationProviderClient. I have a sample ready using the new API's supporting the version from 4.x to 9.x.

Well I'll appreciate if the new API changes can be replicated in this codelab, so it'll be really good for the ones exploring out Location Api to be updated. Having said that if you suggest I can quickly fork out the branch and make the necessary changes.

Thanks

Getting null LocationResult

Getting LocationResult null in onReceive method of LocationUpdatesBroadcastReceiver

public class LocationUpdatesBroadcastReceiver extends BroadcastReceiver {
    private static final String TAG = "LUBroadcastReceiver";

    static final String ACTION_PROCESS_UPDATES =
            "com.google.android.gms.location.sample.backgroundlocationupdates.action" +
                    ".PROCESS_UPDATES";

    @Override
    public void onReceive(Context context, Intent intent) {        
        if (intent != null) {
            final String action = intent.getAction();
            if (ACTION_PROCESS_UPDATES.equals(action)) {
                LocationResult result = LocationResult.extractResult(intent);  //this result is null

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.