Socials: ▻Instagram: ▻Twitter: ▻Facebook: Hi, Im starting with new serie, I want to show you …
Nguồn:https://u-os.org/
Xem thêm Bài Viết:
- Hướng dẫn cách lắp anten ngoài trời đúng kỹ thuật, thu sóng khỏe nhất
- Giải đáp bí ẩn Xamarin là gì? Ưu và nhược điểm khi sử dụng Xamarin
- Tuyệt chiêu sửa lỗi window photo viewer can’t open this picture because
- Bộ nhớ đệm là gì? Có nên xóa bộ nhớ đệm trên thiết bị không?
- Bật mí 3 cách chụp ảnh bằng máy tính win 7 dễ như ăn kẹo
48 Comments
Actual versions today:
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
implementation 'com.google.firebase:firebase-messaging:20.1.0'
4:40: instead of – FirebaseInstanceIdService;
use – FirebaseMessagingService;
Thanks for your tutorial! You have done a great work!
Can you send me whole code?
please make your new version or share resource
@19:54, if I may please know where you are getting the (userid), I cant seem to see that in the series.
please help me, thanks in advance
when i click on received notification, it won't take me take me to the MessageActivity, my app is getting crashed at that time
it shows below runtime exception
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.gajanan.example.chatappusingfirebase, PID: 26804
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gajanan.example.chatappusingfirebase/com.gajanan.example.chatappusingfirebase.MessageActivity}: java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
at android.app.ActivityThread.access$800(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
at com.google.firebase.database.DatabaseReference.child(com.google.firebase:firebase-database@@16.0.4:101)
at com.gajanan.example.chatappusingfirebase.MessageActivity.onCreate(MessageActivity.java:131)
at android.app.Activity.performCreate(Activity.java:5242)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
at android.app.ActivityThread.access$800(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Use FirebaseMessagingService and method onNewToken !
Loved your videos so far. really helpful.
But why are you using a class that is already deprecated?
Now they've deleted it completely and I don't know how to continue or with what to replace it.
COMMUNICATE with your subscribers
Many things are depprecated what to do now
no explanation atleast explain the steps while coding.
why we cannot only use firebase cloud messaging .what is the need to use retrofit plz explain
i dont understand anything from this retrofit shit
how i can send notifiction form user to all user
i have button take a pic on my app
and i need when user taked a pic this pic send to all user app in notifiction
sir, i have an error in extend class FirebaseInstanceIdServices
FirebaseInstanceIdService is not found
hello sir, i need your help. i am not getting message notification, I am receiving token at server end in firebase, cloud notification are workig fine . but message notification not working, please help me on that? Thank you in advance sir!!!
when i clicked on the notification l app crashe why!!
Kod dev pls add chatrooms in this app. Pls
The app has the following features:
Sending a message to all users joining to the room.Notifies when each user joins or leaves.Notifies when an user start typing a message. And text colour
how send notification all user with a topics?
can someone explain in detail everything he did there?
why the notifications just work on API 23 ??? on other API version not working, please help me
i cannot import firebaseInstanceIdServices….so how can i do that?
My System.UI is crashing when recieving notification??? Any idea how to make it correct
video quality poor yaar:(
in last two videos:(
i got error pls help
com.google.firebase.database.DatabaseException: Can't convert object of type java.lang.String to type com.example.myapp.Notifications.Token
the problem is on "Token token = ds.getValue(Token.class);
"
please somebody help
private void sendNotification(final String hisUid, final String nama, final String message) {
DatabaseReference allTokens = FirebaseDatabase.getInstance().getReference("Tokens");
Query query = allTokens.orderByKey().equalTo(hisUid);
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot ds: dataSnapshot.getChildren()){
Token token = ds.getValue(Token.class);
Data data = new Data(myUid, nama+":"+message, "New Message", hisUid, R.drawable.profile);
Sender sender = new Sender(data, token.getToken());
apiService.sendNotification(sender)
.enqueue(new Callback<Response>() {
@Override
public void onResponse(Call<Response> call, retrofit2.Response<Response> response) {
Toast.makeText(ChatActivity.this, ""+response.message(), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(Call<Response> call, Throwable t) {
}
});
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
My token.java
public class Token {
public String token;
public Token(String token) {
this.token = token;
}
public Token() {
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
FirebaseId Service not available plus i cannot import it. I cannot extend FirebaseId Service
How to solve error at 04:40 : FirebaseId Service
MyFirebaseIdService extends FirebaseInstanceIdService [error line]
error decription: Can't resolve Symbol 'FirebaseInstanceIdService '
Can u show your firebase structure
How to solve error at 04:40 : FirebaseId Service
MyFirebaseIdService extends FirebaseInstanceIdService [error line]
error decription: Can't resolve Symbol 'FirebaseInstanceIdService '
Why i cannot import com.google.firebase.iid.FirebaseInstanceIdService;?
FirebaseInstanceIdService is not available what should i do?
notification not showing in sdk versions below oreo
Notification not showing when app killed in customized ROM mobiles like oppo, vivo, xyomi etc. How to solve this?
How can i get the source code ? I am not getting any notification even after trying hundred times.
thank you so much it worked
didn't get the chatted user list in chat fragment from user side
Keep ur work consistent like this only, my friend ur doing great job…..Niceee
error on 9:30 ! its required '=' expected
"Content-Type:application/json"
,"Authorization = serverkey"
what is the error please tell me
when I send a message, my app always cras at
Token token = snapshot.getValue(Token.class);
08:30 If you wondering why ur notification not show.. You need to replace key with ur own server key from Firebase project.
Hi, will appreciate if anyone who encountered the same error can help (sented is null for some reason): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at (FirebaseMessaging.java:37)
clicking on notification crashes the app, because userid is null which is passed from UserAdapter, and if we click the notification it directly open the MessageActivity without getting intent from UserAdapter.
*UserAdapter
in onBindViewHolder()
Intent openMessage=new Intent(mContext, MessageActivity.class);
openMessage.putExtra("userId",user.getId());
mContext.startActivity(openMessage);
help me java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at com.example.ecoleprimairee.Notifications.MyFirebaseMessaging.onMessageReceived(MyFirebaseMessaging.java:24)
if(firebaseUser!=null && sented.equals ( firebaseUser.getUid () )){
sendNotification ( remoteMessage );
}
Is something wrong with this? Why?
(Caused by: java.lang.IllegalArgumentException: Illegal URL: htpps://fcm.googleapis.com/)
can you show your firebase token?
Can't convert object of type java.lang.String to type com.example.asus.program.notification.Token
why?
For those having problem receiving notifications, try this : in the MyFirebaseMessaging class override onNewToken and copy the function updateToken from the MyFirebaseIdService to the MyFirebaseMessaging class then you can delete the MyFirebaseIDService, so you should have something like this in MyFirebaseMessaging class:
@Override
public void onNewToken(String s) {
super.onNewToken(s);
String refreshToken = FirebaseInstanceId.getInstance().getInstanceId().getResult().getToken();
if (refreshToken != null){
updateToken(refreshToken);
}
}
private void updateToken(String refreshToken) {
if (FirebaseAuth.getInstance().getCurrentUser() != null){
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Tokens");
Token token = new Token(refreshToken);
reference.child(firebaseUser.getUid()).setValue(token);
}
}