Background Push Notification In Sketchware | How To Make Notification In Sketchware ( User + Admin )
(ads1)
FCM Codes
2. com.google.firebase.messaging.FirebaseMessagingService
3. android:directBootAware="true"
4. com.google.firebase.messaging.FirebaseMessagingService
5. .FCMService
Import Code
com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
import com.google.firebase.messaging.FirebaseMessaging
On Create Code
1. _toolbar.setTitleTextColor(Color.parseColor("#000000"));
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back_black);
2. recyclerview1.setLayoutManager(new GridLayoutManager(this, 1));
3. query = notification.limitToLast((int)limit).orderByChild(key);
query.addValueEventListener(valueEventListener1);
4. }
com.google.firebase.database.Query query;
5. ValueEventListener valueEventListener1 = new ValueEventListener() {
@Override public void onDataChange(DataSnapshot _param1) {
try {
str ="";
notiMap.clear();
GenericTypeIndicator < HashMap< String, Object>> _ind = new GenericTypeIndicator<HashMap< String, Object>>() {};
for (DataSnapshot _data : _param1.getChildren()) {
str = (_data.getKey());
HashMap <String, Object> _map= _data.getValue(_ind);
notiMap.add(_map);
}
6. } catch (Exception e) { showMessage(e.toString()); } }
@Override public void onCancelled(DatabaseError databaseError) { } }; {
On Post Create Code
1. recyclerview1.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (! recyclerView.canScrollVertically(1))
{
2. query = notification.limitToLast((int)limit).orderByChild(key);
query.addValueEventListener(valueEventListener1);
3. }
}
});
Get Project
Download - https://bit.ly/3zKEZBm
Sketchware Pro Download - https://tei.ai/bBPe1
(ads2)
Tutorial Video -
📸 Social Media
Telegram 👉 https://t.me/sketch_store_yt
Instagram 👉 https://www.instagram.com/sketch_store_yt




