'Error while adding Galaxy Store review broadcast

I publish my apps and games on Galaxy Store some apps are here in this LINK

Using official (document)[https://developer.samsung.com/galaxy-store/customer-review/galaxy-store-review-broadcast.html] provided by Galaxy Store Developers I tried making a broadcaste of Rate this app in OnCreate inside MainActivity.java

Code I used in OnCreate:

ApplicationInfo ai = 
   getPackageManager().getApplicationInfo("com.sec.android.app.samsungapps",
   PackageManager.GET_META_DATA);
int inappReviewVersion = ai.metaData.getInt("com.sec.android.app.samsungapps.review.inappReview", 0);
if (inappReviewVersion > 0){
   // if inappReviewVersion is larger than zero, Galaxy Store supports in-app review function
} else {
   // else, Galaxy Store does not support in-app review function
}
// 1. Check your review authority by Galaxy Store package
Intent intent = new Intent("com.sec.android.app.samsungapps.REQUEST_INAPP_REVIEW_AUTHORITY");
intent.setPackage("com.sec.android.app.samsungapps");
intent.putExtra("callerPackage", com.protecgames.htmleditor);  // targetPacakge : your package name
sendBroadcast(intent);
// 2. Get result of authority checking from Galaxy Store package
IntentFilter filter = new IntentFilter();
filter.addAction("com.sec.android.app.samsungapps.RESPONSE_INAPP_REVIEW_AUTHORITY");
authorityReceiver = new BroadcastReceiver() {
   @Override
   public void onReceive(Context context, Intent intent) {
      // If true, you have authority to write review
      boolean hasAuthority = intent.getBooleanExtra("hasAuthority", false);

      // By using deeplinkUrlForReview, you can open review activity of Galaxy Store
      String deeplinkUri = intent.getStringExtra("deeplinkUri");
   }
}
Intent intent = new Intent();
intent.setData(Uri.parse(deeplinkUri));    // deeplinkUri, included in response intent
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
startActivity(intent);

The error while executing project:

----------
1. ERROR in /storage/emulated/0/.sketchware/mysc/601/app/src/main/java/com/my/newproject/MainActivity.java (at line 44)
    ApplicationInfo ai = getPackageManager().getApplicationInfo("com.sec.android.app.samsungapps", PackageManager.GET_META_DATA); int inappReviewVersion = ai.metaData.getInt("com.sec.android.app.samsungapps.review.inappReview", 0); if (inappReviewVersion > 0){ // if inappReviewVersion is larger than zero, Galaxy Store supports in-app review function } else { // else, Galaxy Store does not support in-app review function } // 1. Check your review authority by Galaxy Store package Intent intent = new Intent("com.sec.android.app.samsungapps.REQUEST_INAPP_REVIEW_AUTHORITY"); intent.setPackage("com.sec.android.app.samsungapps"); intent.putExtra("callerPackage", com.protecgames.htmleditor); // targetPacakge : your package name sendBroadcast(intent); // 2. Get result of authority checking from Galaxy Store package IntentFilter filter = new IntentFilter(); filter.addAction("com.sec.android.app.samsungapps.RESPONSE_INAPP_REVIEW_AUTHORITY"); authorityReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // If true, you have authority to write review boolean hasAuthority = intent.getBooleanExtra("hasAuthority", false); // By using deeplinkUrlForReview, you can open review activity of Galaxy Store String deeplinkUri = intent.getStringExtra("deeplinkUri"); } } Intent intent = new Intent(); intent.setData(Uri.parse(deeplinkUri)); // deeplinkUri, included in response intent intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_INCLUDE_STOPPED_PACKAGES); startActivity(intent); 
                                                                                                                                                                                                                                                                   ^
Syntax error, insert "}" to complete Statement
----------
1 problem (1 error)

I am using Sketchware v6.4.0 Beta 6 with add Source Directly block



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source