Comments (6)
This is a bug in the sample code. FirebaseUser#getPhotoUrl
actually returns a nullable
Uri
.
Replace user.getPhotoUrl().toString()
with user.getPhotoUrl() != null ? user.getPhotoUrl().toString() : null
.
Better yet, you can submit a PR to fix the issue. 👍
from friendlypix.
Hi i am also having the same problem with this code similar to above post
FirebaseUser mUser = mFirebaseAuth.getCurrentUser();
if (mUser != null) {
// User is signed in
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
String uid = mFirebaseAuth.getCurrentUser().getUid();
THIS
LINE String image = mFirebaseAuth.getCurrentUser().getPhotoUrl().toString();
intent.putExtra("user_id", uid);
if(image!=null){
intent.putExtra("profile_picture",image);
}
startActivity(intent);
startActivity(intent);
finish();
Log.d(TAG, "onAuthStateChanged:signed_in:" + mUser.getUid());
}
any help
from friendlypix.
What is the solution for this?
the following suggestion by tikurahul dint work
Replace user.getPhotoUrl().toString() with user.getPhotoUrl() != null ? user.getPhotoUrl().toString() : null
from friendlypix.
public static Author getAuthor() {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user == null) return null;
return new Author(user.getDisplayName(), user.getPhotoUrl() != null ? user.getPhotoUrl().toString() : null, user.getUid());
}
@jamespinto I agree with @tikurahul this should fix it, if the error in this line is:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference
from friendlypix.
nope! not working. I am using the google signin provider to log the user in.
According to the google documentation (the below code also gives me the same nullpointer exception)
Get a user's provider-specific profile information
To get the profile information retrieved from the sign-in providers linked to a user, use the getProviderData method. For example:
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
for (UserInfo profile : user.getProviderData()) {
// Id of the provider (ex: google.com)
String providerId = profile.getProviderId();
// UID specific to the provider
String uid = profile.getUid();
// Name, email address, and profile photo Url
String name = profile.getDisplayName();
String email = profile.getEmail();
Uri photoUrl = profile.getPhotoUrl();
};
}
from friendlypix.
This issue was moved to googlearchive/friendlypix-android#27
from friendlypix.
Related Issues (20)
- Problem with getDownloadUrl()
- iOS Crash Upon Open HOT 5
- File upload consistently failing HOT 2
- IOS: App Crashes after SignIn (In Home feeds) HOT 2
- App crashes after submit button pressed. HOT 3
- Couldn't resize bitmap HOT 4
- unable to cache image HOT 5
- [iOS] Crash: Post Sign-In HOT 1
- Generating thumbnails using cloud functions HOT 3
- Getting numerous errors after deploying site HOT 11
- I'm getting a an error for the feed on Web HOT 2
- Facebook profile picture now returning 403: URL signature expired HOT 4
- update to android friendlypix
- [Android] Unable to proceed after signing-in with a valid Google account. HOT 2
- App still crashes after submit button pressed HOT 3
- Project based on friendlypix
- Issue With The User Details Activity Screen. HOT 1
- PostsFragment$4.toggleLike(PostsFragment.java:188) HOT 1
- what is profile_id in design.md? HOT 1
- Error while uploading new pic TypeError: "snapshot.metadata.downloadURLs is undefined" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from friendlypix.