Last active
September 8, 2019 09:51
-
-
Save divyanshub024/dd6346a83612f9779ec21f0bac196546 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const val CHANNEL = "com.divyanshu.chitr/wallpaper" | |
class MainActivity: FlutterActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
GeneratedPluginRegistrant.registerWith(this) | |
MethodChannel(flutterView, CHANNEL).setMethodCallHandler { call, result -> | |
if (call.method == "setWallpaper") { | |
val arguments = call.arguments as ArrayList<*> | |
val setWallpaper = setWallpaper(arguments[0] as String, applicationContext, arguments[1] as Int) | |
if (setWallpaper == 0) { | |
result.success(setWallpaper) | |
} else { | |
result.error("UNAVAILABLE", "", null) | |
} | |
} else { | |
result.notImplemented() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment