Git Product home page Git Product logo

advancedandroid_shushme's Introduction

ShushMe

This is the toy app for the Places lesson of the Advanced Android App Development course on Udacity.

Screenshots

Screenshot1 Screenshot2 Screenshot3 Screenshot4 Screenshot5 Screenshot6

How to use this repo while taking the course

Each code repository in this class has a chain of commits that looks like this:

listofcommits

These commits show every step you'll take to create the app. They include Exercise commits and Solution commits.

Exercise commits contain instructions for completing the exercise, while solution commits show the completed exercise. You can tell what a commit is by looking at its commit message.

For example, TFCM.01-Exercise-AddGradleDependencies is the first code step in the Firebase Cloud Messaging (FCM) lesson. This is the exercise commit, and the exercise is called Add Gradle Dependencies.

Each commit also has a branch associated with it of the same name as the commit message, seen below:

branches Access all branches from this tab

listofbranches

branchesdropdown

The branches are also accessible from the drop-down in the "Code" tab

Working with the Course Code

Here are the basic steps for working with and completing exercises in the repo. This information is linked whenever you start a new exercise project, so don't feel you need to memorize all of this! In fact, skim it now, make sure that you know generally how to do the different tasks, and then come back when you start your first exercise.

The basic steps are:

  1. Clone the repo
  2. Checkout the exercise branch
  3. Find and complete the TODOs
  4. Optionally commit your code changes
  5. Compare with the solution

Step 1: Clone the repo

As you go through the course, you'll be instructed to clone the different exercise repositories, so you don't need to set these up now. You can clone a repository from github in a folder of your choice with the command:

git clone https://github.com/udacity/REPOSITORY_NAME.git

Step 2: Checkout the exercise branch

As you do different exercises in the code, you'll be told which exercise you're on, as seen below: exerciseexample

To complete an exercise, you'll want to check out the branch associated with that exercise. For the exercise above, the command to check out that branch would be:

git checkout TFCM.01-Exercise-AddGradleDependencies

Step 3: Find and complete the TODOs

This branch should always have Exercise in the title. Once you've checked out the branch, you'll have the code in the exact state you need. You'll even have TODOs, which are special comments that tell you all the steps you need to complete the exercise. You can easily navigate to all the TODOs using Android Studio's TODO tool. To open the TODO tool, click the button at the bottom of the screen that says TODO. This will display a list of all comments with TODO in the project.

We've numbered the TODO steps so you can do them in order: todos

Step 4: Optionally commit your code changes

After You've completed the TODOs, you can optionally commit your changes. This will allow you to see the code you wrote whenever you return to the branch. The following git code will add and save all your changes.

git add .
git commit -m "Your commit message"

Step 5: Compare with the solution

Most exercises will have a list of steps for you to check off in the classroom. Once you've checked these off, you'll see a pop up window with a link to the solution code. Note the Diff link:

solutionwindow

The Diff link will take you to a Github diff as seen below: diff

All of the code that was added in the solution is in green, and the removed code (which will usually be the TODO comments) is in red.

Report Issues

Notice any issues with a repository? Please file a github issue in the repository.

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

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

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().

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.

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'
    }
}

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?

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 ?

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.