Friday, June 21, 2019

How To Check For Update In Sketchware

How To Check For Update In Sketchware

1.  Connect to Firebase project


2.  Create a Firebase DB component


3.  Create string variables: packageNamelatestVersion, userVersion. And a Map: UpdateNotifier

(onCreate)

4. Set the string variable, "packageName" to your package name of your app.

5.  Add ASD block:


try {

android.content.pm.PackageInfo pinfo = getPackageManager().getPackageInfo( packageName, android.content.pm.PackageManager.GET_ACTIVITIES);
your_version = pinfo.versionName; }
catch (Exception e){ showMessage(e.toString()); }


6.  Add another ASD block:

DatabaseReference rootRef = _firebase.getReference(); rootRef.child("Update Notification s").addListenerForSingleValueEvent(new ValueEventListener() {

@Override
public void onDataChange(DataSnapshot snapshot) {
if (snapshot.exists()) { } else {

7.  The Map variable should look like this:



8.  Add another ASD block:

} }
@Override
public void onCancelled(DatabaseError _error) { } });

9.  Create a List Map: ListMap

10.  Add event FDB1 : Update Notifications onChildAdded
The event will look like this: