GithubHelp home page GithubHelp logo

advancedandroid_shushme's People

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  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  avatar  avatar

advancedandroid_shushme's Issues

Updated Gradle & Dependencies

As of today, this build.gradle works for me (StarterCode):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.example.android.shushme"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    api fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    api 'com.android.support:appcompat-v7:28.0.0'
    api 'com.android.support:recyclerview-v7:28.0.0'
    testImplementation 'junit:junit:4.12'
    api ('com.google.android.gms:play-services-places:16.0.0') {
        exclude group: 'com.android.support', module: 'support-v4'
    }
    api ('com.google.android.gms:play-services-location:16.0.0') {
        exclude group: 'com.android.support', module: 'support-v4'
    }
}

Places Api Deprecated

As of July 29, 2019, the Places API is deprecated and the new library for Places is being introduced. This code will not work. The project needs to be migrated to the new library.

image

Cloning error

Due to some issue in github, this project was unable to be cloned.

Manifest permission missing.

The manifest permission "android.permission.ACCESS_NOTIFICATION_POLICY" is missing, which is required in order to access the notification policy settings.

PlaceBuffer must be released after use.

Google documentation says "NOTE: The calling application must release() this object after it is done with it to prevent a memory leak".

Without this I get this errors in log:

E/DataBuffer: Internal data leak within a DataBuffer object detected! Be sure to explicitly call release() on all DataBuffer extending objects when you are done with them. (internal object: com.google.android.gms.common.data.DataHolder@5ed0442)

To fix this I added if (mPlaces != null) mPlaces.release(); call at the beginning of PlaceListAdapter.swapPlaces().

Ringer mode issues

Hi!

When trying this solution final code on my phone (running with Android N), I ran into some issues which made the app crash:

  1. Some packages in the GeofenceBroadcastReceiver file have not been imported, so that it does not let compile.

  2. The permission for the ACCESS NOTIFICATION POLICY is not present in the Manifest.xml file.

  1. Since when we want to change the Ringer mode we want to make sure that Notification Policy Access is granted (in case our SDK is 24 or greater), I think the appropriate code should be:

if (android.os.Build.VERSION.SDK_INT < 24 ||
(android.os.Build.VERSION.SDK_INT >= 24 && nm.isNotificationPolicyAccessGranted()))
...

and not
if (android.os.Build.VERSION.SDK_INT < 24 ||
(android.os.Build.VERSION.SDK_INT >= 24 && !nm.isNotificationPolicyAccessGranted()))
...

I actually removed the "!", since in the current version of the code we try to change the Ringer mode status when the permission is not granted...

Thanks for your great tutorials guys!

Kind regards,

Gaël

GeofencingApi is deprecated

It have been replace by "GeofencingClient" but how do you integrate that in the code ?

    public void registerAllGeofences(){
        if (mGoogleApiClient == null || mGoogleApiClient.isConnected() || mGeofenceList == null || mGeofenceList.size() == 0) {
            return;
        }
        try {
            LocationServices.GeofencingApi.addGeofences(mGoogleApiClient, getGeofencingRequest(), getGeofencePendingIntent()).setResultCallback(this);
        } catch (SecurityException securityException) {
            Log.e(TAG, securityException.getMessage());
        }
    }

    public void unRegisterAllGeofences() {
        if (mGoogleApiClient == null || !mGoogleApiClient.isConnected()) {
            return;
        }
        try {
            LocationServices.GeofencingApi.removeGeofences(
                    mGoogleApiClient,
                    // This is the same pending intent that was used in registerGeofences
                    getGeofencePendingIntent()
            ).setResultCallback(this);
        } catch (SecurityException securityException) {
            // Catch exception generated if the app does not use ACCESS_FINE_LOCATION permission.
            Log.e(TAG, securityException.getMessage());
        }
    }

Become ?

place.getAddress().toString on a Null Pointer Reference

In the branch T0X.03-Solution-GetPlaceById, whenever a location is selected the app crashes saying
07-01 07:32:45.813 1528-1528/com.example.android.shushme E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.android.shushme, PID: 1528 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.example.android.shushme/com.example.android.shushme.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:3659) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3702) at android.app.ActivityThread.access$1300(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5343) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference at com.example.android.shushme.MainActivity.onActivityResult(MainActivity.java:172) at android.app.Activity.dispatchActivityResult(Activity.java:6218) at android.app.ActivityThread.deliverResults(ActivityThread.java:3655) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3702)  at android.app.ActivityThread.access$1300(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372) 

Does this app run

I followed instructions for the shushme app exercise. I even took the final solution updated my key and tried to run it but I have not been able to see any notifications or any indication that is changing the ring. Does anyone have a git with a running version? that does what is required as intended?

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.