rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
288 stars 329 forks source link

Use other plugins in callback not working after upgrading to 1.4.0+1 #201

Open khalitovsv opened 3 years ago

khalitovsv commented 3 years ago

When building app, getting this error:

e: C:\Development\Projects\Flutter\Test\android\app\src\main\kotlin\oko\oko\Application.kt: (8, 37): Unresolved reference: LocatorService

Application.kt

package oko.oko

import io.flutter.app.FlutterApplication;
import io.flutter.view.FlutterMain;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.battery.BatteryPlugin;
import rekab.app.background_locator.LocatorService;

class Application : FlutterApplication(), PluginRegistrantCallback {
    override fun onCreate() {
        super.onCreate()
        LocatorService.setPluginRegistrant(this)
        FlutterMain.startInitialization(this)
    }

    override fun registerWith(registry: PluginRegistry?) {
        if (!registry!!.hasPlugin("io.flutter.plugins.battery")) {
            BatteryPlugin.registerWith(registry!!.registrarFor("io.flutter.plugins.battery"))
        }
    }
}

And version 1.4.0 realy doen't contains LocatorServer.kt file, unlike version 1.3.2

mehdok commented 3 years ago

HI @khalitovsv Thank you for opening a new issue.

LocatorService is removed from the recent version. Please refer to the wiki for more info.

khalitovsv commented 3 years ago

Can you update instruction https://github.com/rekab-app/background_locator/wiki/Use-other-plugins-in-callback?

mehdok commented 3 years ago

Thank you for pointing out, It's been updated;

steinmetz commented 3 years ago

[suggestion] I think it would be a good idea to add the necessary imports to this instruction (people using VS Code may need to open Android Studio to figure out what imports are missing) : https://github.com/rekab-app/background_locator/wiki/Use-other-plugins-in-callback

Also, some classes are deprecated, maybe this will be a problem in the future: image