background_locator icon indicating copy to clipboard operation
background_locator copied to clipboard

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

Open khalitovsv opened this issue 4 years ago • 4 comments

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

khalitovsv avatar Feb 15 '21 04:02 khalitovsv

HI @khalitovsv Thank you for opening a new issue.

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

mehdok avatar Feb 15 '21 05:02 mehdok

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

khalitovsv avatar Feb 15 '21 05:02 khalitovsv

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

mehdok avatar Feb 15 '21 06:02 mehdok

[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

steinmetz avatar Mar 28 '21 18:03 steinmetz