Java Code Examples for io.flutter.plugin.common.MethodChannel.Result#notImplemented()

The following examples show how to use io.flutter.plugin.common.MethodChannel.Result#notImplemented() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThumbnailsPlugin.java    From Flutter_Thumbnails with MIT License 6 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
    Map<String, Object> arguments = call.arguments();
    if (call.method.equals("getThumbnail")) {

        String videoFile = (String) arguments.get("videoFilePath");
        String thumbOutputFile = (String) arguments.get("thumbFilePath");
        int imageType = (int) arguments.get("thumbnailFormat");
        int quality = (int) arguments.get("thumbnailQuality");
        try {
            String thumbnailPath = buildThumbnail(videoFile, thumbOutputFile, imageType, quality);
            result.success(thumbnailPath);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    } else {
        result.notImplemented();
    }
}
 
Example 2
Source File: FlutterQrReaderPlugin.java    From flutter_qr_reader with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
  if (call.method.equals("imgQrCode")) {
    imgQrCode(call, result);
  } else {
    result.notImplemented();
  }
}
 
Example 3
Source File: AppUsagePlugin.java    From flutter-plugins with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
    long start = call.argument("start");
    long end = call.argument("end");
    HashMap<String, Double> usage = Stats.getUsageMap(reg.context(), start, end);

    if (call.method.equals("getUsage")) {
        result.success(usage);
    } else {
        result.notImplemented();
    }
}
 
Example 4
Source File: SquareReaderSdkFlutterPlugin.java    From reader-sdk-flutter-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
  String methodName = call.method;
  if (methodName.equals("isAuthorized")) {
    authorizeModule.isAuthorized(result);
  } else if (methodName.equals("isAuthorizationInProgress")) {
    authorizeModule.isAuthorizationInProgress(result);
  } else if (methodName.equals("authorizedLocation")) {
    authorizeModule.authorizedLocation(result);
  } else if (methodName.equals("authorize")) {
    String authCode = call.argument("authCode");
    authorizeModule.authorize(authCode, result);
  } else if (methodName.equals("canDeauthorize")) {
    authorizeModule.canDeauthorize(result);
  } else if (methodName.equals("deauthorize")) {
    authorizeModule.deauthorize(result);
  } else if (methodName.equals("startCheckout")) {
    HashMap<String, Object> checkoutParams = call.argument("checkoutParams");
    checkoutModule.startCheckout(checkoutParams, result);
  } else if (methodName.equals("startReaderSettings")) {
    readerSettingsModule.startReaderSettings(result);
  } else if (methodName.equals("startStoreCard")) {
    String customerId = call.argument("customerId");
    storeCustomerCardModule.startStoreCard(customerId, result);
  } else {
    result.notImplemented();
  }
}
 
Example 5
Source File: BackgroundLocationUpdatesPlugin.java    From background_location_updates with Apache License 2.0 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, final Result result) {
  if (call.method.equals("getPlatformVersion")) {
    result.success("Android " + android.os.Build.VERSION.RELEASE);
  } else if (call.method.equals("trackStart/android-strategy:periodic")) {
    startTrackingWithPeriodicStrategy(call, result);
  } else if (call.method.equals("trackStop/android-strategy:periodic")) {
    stopTrackingWithPeriodicStrategy();
    result.success(null);
  } else if (call.method.equals("trackStart/android-strategy:broadcast")) {
    startTrackingWithBroadcastStrategy(call);
  } else if (call.method.equals("trackStop/android-strategy:broadcast")) {
    stopTrackingWithBroadcastStrategy();
  } else if (call.method.equals("getLocationTracesCount")) {
    new CountRetriever(result, mContext).execute(CountRetriever.CountRetrievalMode.RETRIEVE_ALL);
  } else if (call.method.equals("getUnreadLocationTracesCount")) {
    new CountRetriever(result, mContext).execute(CountRetriever.CountRetrievalMode.RETRIEVE_UNREAD);
  } else if (call.method.equals("getUnreadLocationTraces")) {
    new TraceRetriever(result, mContext).execute(TraceRetriever.TraceRetrievalMode.RETRIEVE_UNREAD);
  } else if (call.method.equals("getLocationTraces")) {
    new TraceRetriever(result, mContext).execute(TraceRetriever.TraceRetrievalMode.RETRIEVE_ALL);
  } else if (call.method.equals("markAsRead")) {
    markLocationTracesAsRead(call, result);
  } else if (call.method.equals("requestPermission")) {
    requestPermission(result);
  } else if (call.method.equals("getSqliteDatabasePath")) {
    getSqliteDatabasePath(result);
  } else if ( call.method.equals("revertActiveStrategy")) {
    revertActiveUnknownStrategy();
    result.success(true);
  } else {
    result.notImplemented();
  }
}
 
Example 6
Source File: MusicFinderPlugin.java    From Flute-Music-Player with Apache License 2.0 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
  if (call.method.equals("getPlatformVersion")) {
    result.success("Android " + android.os.Build.VERSION.RELEASE);
  } else if (call.method.equals("getSongs")) {
    pendingResult = result;
    if (!(call.arguments instanceof Map)) {
      throw new IllegalArgumentException("Plugin not passing a map as parameter: " + call.arguments);
    }
    arguments = (Map<String, Object>) call.arguments;
    boolean handlePermission = (boolean) arguments.get("handlePermissions");
    this.executeAfterPermissionGranted = (boolean) arguments.get("executeAfterPermissionGranted");
    checkPermission(handlePermission);
    // result.success(getData());

  } else if (call.method.equals("play")) {
    String url = ((HashMap) call.arguments()).get("url").toString();
    Boolean resPlay = play(url);
    result.success(1);
  } else if (call.method.equals("pause")) {
    pause();
    result.success(1);
  } else if (call.method.equals("stop")) {
    stop();
    result.success(1);
  } else if (call.method.equals("seek")) {
    double position = call.arguments();
    seek(position);
    result.success(1);
  } else if (call.method.equals("mute")) {
    Boolean muted = call.arguments();
    mute(muted);
    result.success(1);
  } else {
    result.notImplemented();
  }
}
 
Example 7
Source File: AndroidJobSchedulerPlugin.java    From android_job_scheduler with Apache License 2.0 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        result.error("JobScheduler API is not available in API Level 20 and below.", "", null);
        return;
    }
    if (call.method.equals("scheduleEvery")) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            PersistableBundle bundle = AndroidJobSchedulerUtils.serializedDataToPersistableBundle((ArrayList<?>) call.arguments, mContext);

            AndroidJobScheduler.scheduleEvery(this.mContext, AndroidJobSchedulerUtils.persistableBundleToJobInfo(bundle));
            result.success(true);
        } else {
            result.success(false);
        }
    } else if (call.method.equals("cancelJob")) {
        final ArrayList<?> args = (ArrayList<?>) call.arguments;
        AndroidJobScheduler.cancelJob(this.mContext, (Integer) args.get(0));
    } else if (call.method.equals("cancelAllJobs")) {
        AndroidJobScheduler.cancelAllJobs(this.mContext);
    } else if (call.method.equals("getAllPendingJobs")) {
        List<JobInfo> jobs = AndroidJobScheduler.getAllPendingJobs(this.mContext);
        List<Integer> jobIds = new ArrayList<>();
        for(JobInfo job : jobs) {
            jobIds.add(job.getId());
        }
        result.success(jobIds);
    } else {
        result.notImplemented();
    }
}
 
Example 8
Source File: NativeDeviceOrientationPlugin.java    From flutter_native_device_orientation with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, final Result result) {
    switch (call.method) {
        case "getOrientation":
            Boolean useSensor = call.argument("useSensor");

            if(useSensor != null && useSensor){
                // we can't immediately retrieve a orientation from the sensor. We have to start listening
                // and return the first orientation retrieved.
                reader.getSensorOrientation(new IOrientationListener.OrientationCallback(){

                    @Override
                    public void receive(OrientationReader.Orientation orientation) {
                        result.success(orientation.name());
                    }
                });
            }else{
                result.success(reader.getOrientation().name());
            }
            break;

        case "pause":
            pause();
            result.success(null);
            break;

        case "resume":
            resume();
            result.success(null);
            break;
        default:
            result.notImplemented();
    }
}
 
Example 9
Source File: ContactsServicePlugin.java    From flutter_contacts with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
  switch(call.method){
    case "getContacts":
      this.getContacts((String)call.argument("query"), (boolean)call.argument("withThumbnails"), (boolean)call.argument("photoHighResolution"), result);
      break;
    case "getContactsForPhone":
      this.getContactsForPhone((String)call.argument("phone"), (boolean)call.argument("withThumbnails"), (boolean)call.argument("photoHighResolution"), result);
      break;
    case "addContact":
      Contact c = Contact.fromMap((HashMap)call.arguments);
      if(this.addContact(c)) {
        result.success(null);
      } else{
        result.error(null, "Failed to add the contact", null);
      }
      break;
    case "deleteContact":
      Contact ct = Contact.fromMap((HashMap)call.arguments);
      if(this.deleteContact(ct)){
        result.success(null);
      } else{
        result.error(null, "Failed to delete the contact, make sure it has a valid identifier", null);
      }
      break;
    case "updateContact":
      Contact ct1 = Contact.fromMap((HashMap)call.arguments);
      if(this.updateContact(ct1)) {
        result.success(null);
      } else {
        result.error(null, "Failed to update the contact, make sure it has a valid identifier", null);
      }
      break;
    default:
      result.notImplemented();
      break;
  }
}
 
Example 10
Source File: FlutterExifRotationPlugin.java    From flutter_exif_rotation with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
    this.result = result;
    this.call = call;
    if (call.method.equals("getPlatformVersion")) {
        result.success("Android " + android.os.Build.VERSION.RELEASE);
    } else if (call.method.equals("rotateImage")) {
        rotateImage();
    } else {
        result.notImplemented();
    }
}
 
Example 11
Source File: OpenFilePlugin.java    From open_file with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
@SuppressLint("NewApi")
public void onMethodCall(MethodCall call, @NonNull Result result) {
    isResultSubmitted = false;
    if (call.method.equals("open_file")) {
        filePath = call.argument("file_path");
        this.result = result;

        if (call.hasArgument("type") && call.argument("type") != null) {
            typeString = call.argument("type");
        } else {
            typeString = getFileType(filePath);
        }
        if (pathRequiresPermission()) {
            if (hasPermission(Manifest.permission.READ_EXTERNAL_STORAGE)) {
                if (TYPE_STRING_APK.equals(typeString)) {
                    openApkFile();
                    return;
                }
                startActivity();
            } else {
                ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_CODE);
            }
        } else {
            startActivity();
        }
    } else {
        result.notImplemented();
        isResultSubmitted = true;
    }
}
 
Example 12
Source File: WifiPlugin.java    From wifi with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
    if (registrar.activity() == null) {
        result.error("no_activity", "wifi plugin requires a foreground activity.", null);
        return;
    }
    switch (call.method) {
        case "ssid":
            delegate.getSSID(call, result);
            break;
        case "level":
            delegate.getLevel(call, result);
            break;
        case "ip":
            delegate.getIP(call, result);
            break;
        case "list":
            delegate.getWifiList(call, result);
            break;
        case "connection":
            delegate.connection(call, result);
            break;
        default:
            result.notImplemented();
            break;
    }
}
 
Example 13
Source File: FlutterBraintreeDropIn.java    From FlutterBraintree with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
  if (call.method.equals("start")) {
    String clientToken = call.argument("clientToken");
    String tokenizationKey = call.argument("tokenizationKey");
    DropInRequest dropInRequest = new DropInRequest()
            .amount((String) call.argument("amount"))
            .collectDeviceData((Boolean) call.argument("collectDeviceData"))
            .requestThreeDSecureVerification((Boolean) call.argument("requestThreeDSecureVerification"))
            .maskCardNumber((Boolean) call.argument("maskCardNumber"))
            .vaultManager((Boolean) call.argument("vaultManagerEnabled"));

    if (clientToken != null)
      dropInRequest.clientToken(clientToken);
    else if (tokenizationKey != null)
      dropInRequest.tokenizationKey(tokenizationKey);

    readGooglePaymentParameters(dropInRequest, call);
    readPayPalParameters(dropInRequest, call);
    if (!((Boolean) call.argument("venmoEnabled")))
      dropInRequest.disableVenmo();
    if (!((Boolean) call.argument("cardEnabled")))
      dropInRequest.disableCard();

    if (activeResult != null) {
      result.error("drop_in_already_running", "Cannot launch another Drop-in activity while one is already running.", null);
      return;
    }
    this.activeResult = result;
    activity.startActivityForResult(dropInRequest.getIntent(activity), DROP_IN_REQUEST_CODE);
  } else {
    result.notImplemented();
  }
}
 
Example 14
Source File: AdvCameraPlugin.java    From adv_camera with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, final Result result) {
    if (call.method.equals("checkForPermission")) {
        checkForPermission(result);
    } else {
        result.notImplemented();
    }
}
 
Example 15
Source File: FlutterFlipperkitPlugin.java    From flutter_flipperkit with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
    if (!FlipperUtils.shouldEnableFlipper(context)) {
        result.success(true);
        return;
    }

    final String method = call.method;

    if (method.startsWith("pluginDatabaseBrowser")) {
        flipperDatabaseBrowserPlugin.handleMethodCall(call, result);
        return;
    } else if (method.startsWith("pluginReduxInspector")) {
        flipperReduxInspectorPlugin.handleMethodCall(call, result);
        return;
    }

    switch (method) {
        case "clientAddPlugin":
            this.clientAddPlugin(call, result);
            break;
        case "clientStart":
            this.clientStart(call, result);
            break;
        case "clientStop":
            this.clientStop(call, result);
            break;
        case "pluginNetworkReportRequest":
            this.pluginNetworkReportRequest(call, result);
            break;
        case "pluginNetworkReportResponse":
            this.pluginNetworkReportResponse(call, result);
            break;
        default:
            result.notImplemented();
    }
}
 
Example 16
Source File: FlutterSplashScreenPlugin.java    From flutter_splash_screen with MIT License 5 votes vote down vote up
@Override
public void onMethodCall(MethodCall methodCall, Result result) {
    switch (methodCall.method) {
        case "show":
            show();
            break;
        case "hide":
            hide();
            break;
        default:
            result.notImplemented();
    }
}
 
Example 17
Source File: RazorpayFlutterPlugin.java    From razorpay-flutter with MIT License 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void onMethodCall(MethodCall call, Result result) {


    switch (call.method) {

        case "open":
            razorpayDelegate.openCheckout((Map<String, Object>) call.arguments, result);
            break;

        case "resync":
            razorpayDelegate.resync(result);
            break;

        default:
            result.notImplemented();

    }

}
 
Example 18
Source File: MediaPlayerPlugin.java    From media_player with MIT License 4 votes vote down vote up
private void onMethodCall(MethodCall call, Result result, long textureId, VideoPlayer player) {

      switch (call.method) {
    case "setSource":
      Map source = (HashMap) call.argument("source");
      Log.d(TAG, "Source=" + source.toString());
      player.setSource(source, result);
      // result.success(null);
      break;
    case "setPlaylist":
      List<Map> playlist = (List<Map>) call.argument("playlist");
      Log.d(TAG, "Playlist=" + playlist.toString());
      player.setPlaylist(playlist, result);
      // result.success(null);
      break;
    case "setLooping":
      player.setLooping((Boolean) call.argument("looping"));
      result.success(null);
      break;
    case "setVolume":
      player.setVolume((Double) call.argument("volume"));
      result.success(null);
      break;
    case "play":
      Log.i(TAG, "method call play");
      player.play();
      result.success(null);
      break;
    case "pause":
      player.pause();
      result.success(null);
      break;
    case "seekTo":
      int location = ((Number) call.argument("location")).intValue();
      int index = ((Number) call.argument("index")).intValue();
      player.seekTo(location, index);
      result.success(null);
      break;
    case "position":
      result.success(player.getPosition());
      break;
    case "dispose":
       Log.d(TAG, "calling dispose on player instance android");
      player.dispose();
      boolean background = call.argument("isBackground");
      if (background)
        audioServiceBinder.removePlayer(textureId);
      else
        videoPlayers.remove(textureId);
      result.success(null);
      break;
    case "retry":
      player.retry();
      result.success(null);
      break;  
    default:
      result.notImplemented();
      break;
    }
  }
 
Example 19
Source File: WifiIotPlugin.java    From WiFiFlutter with MIT License 4 votes vote down vote up
@Override
public void onMethodCall(MethodCall poCall, Result poResult) {
    switch (poCall.method) {
        case "loadWifiList":
            loadWifiList(poResult);
            break;
        case "forceWifiUsage":
            forceWifiUsage(poCall, poResult);
            break;
        case "isEnabled":
            isEnabled(poResult);
            break;
        case "setEnabled":
            setEnabled(poCall, poResult);
            break;
        case "connect":
            connect(poCall, poResult);
            break;
        case "findAndConnect":
            findAndConnect(poCall, poResult);
            break;
        case "isConnected":
            isConnected(poResult);
            break;
        case "disconnect":
            disconnect(poResult);
            break;
        case "getSSID":
            getSSID(poResult);
            break;
        case "getBSSID":
            getBSSID(poResult);
            break;
        case "getCurrentSignalStrength":
            getCurrentSignalStrength(poResult);
            break;
        case "getFrequency":
            getFrequency(poResult);
            break;
        case "getIP":
            getIP(poResult);
            break;
        case "removeWifiNetwork":
            removeWifiNetwork(poCall, poResult);
            break;
        case "isRegisteredWifiNetwork":
            isRegisteredWifiNetwork(poCall, poResult);
            break;
        case "isWiFiAPEnabled":
            isWiFiAPEnabled(poResult);
            break;
        case "setWiFiAPEnabled":
            setWiFiAPEnabled(poCall, poResult);
            break;
        case "getWiFiAPState":
            getWiFiAPState(poResult);
            break;
        case "getClientList":
            getClientList(poCall, poResult);
            break;
        case "getWiFiAPSSID":
            getWiFiAPSSID(poResult);
            break;
        case "setWiFiAPSSID":
            setWiFiAPSSID(poCall, poResult);
            break;
        case "isSSIDHidden":
            isSSIDHidden(poResult);
            break;
        case "setSSIDHidden":
            setSSIDHidden(poCall, poResult);
            break;
        case "getWiFiAPPreSharedKey":
            getWiFiAPPreSharedKey(poResult);
            break;
        case "setWiFiAPPreSharedKey":
            setWiFiAPPreSharedKey(poCall, poResult);
            break;
        case "setMACFiltering":
            setMACFiltering(poCall, poResult);
            break;
        default:
            poResult.notImplemented();
            break;
    }
}
 
Example 20
Source File: LeancloudFlutterPlugin.java    From leancloud_flutter_plugin with MIT License 4 votes vote down vote up
@Override
public void onMethodCall(MethodCall call, Result result) {
  switch (call.method) {
    case "setServer":
      LeancloudFunction.setServer(call, result);
      break;
    case "initialize":
      LeancloudFunction.initialize(call, result, _applicationContext);
      break;
    case "setLogLevel":
      LeancloudFunction.setLogLevel(call, result);
      break;
    case "setRegion":
      LeancloudFunction.setRegion(call, result);
      break;
    case "saveOrCreate":
      LeancloudObject saveOrCreateObject = new LeancloudObject();
      saveOrCreateObject.saveOrCreate(call, result);
      break;
    case "delete":
      LeancloudObject deleteObject = new LeancloudObject();
      deleteObject.delete(call, result);
      break;
    case "query":
      LeancloudQuery leancloudQuery = new LeancloudQuery();
      leancloudQuery.query(call, result);
      break;
    case "doCloudQuery":
      LeancloudQuery doCloudQueryQuery = new LeancloudQuery();
      doCloudQueryQuery.doCloudQuery(call, result);
      break;
    case "signUp":
      LeancloudUser signUpLeancloudUser = new LeancloudUser();
      signUpLeancloudUser.signUp(call, result);
      break;
    case "login":
      LeancloudUser loginLeancloudUser = new LeancloudUser();
      loginLeancloudUser.login(call, result);
      break;
    default:
      result.notImplemented();
  }
}