-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enables switch to local device for android
- Loading branch information
1 parent
541c29d
commit 523b5e9
Showing
7 changed files
with
253 additions
and
88 deletions.
There are no files selected for viewing
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
25 changes: 25 additions & 0 deletions
25
android/src/main/kotlin/de/minimalme/spotify_sdk/SpotifyConnectApi.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package de.minimalme.spotify_sdk | ||
|
||
import com.spotify.android.appremote.api.SpotifyAppRemote | ||
import com.spotify.protocol.types.Image.Dimension | ||
import com.spotify.protocol.types.ImageUri | ||
import io.flutter.plugin.common.MethodChannel | ||
import java.io.ByteArrayOutputStream | ||
import android.graphics.Bitmap | ||
|
||
class SpotifyConnectApi(spotifyAppRemote: SpotifyAppRemote?, result: MethodChannel.Result) : BaseSpotifyApi(spotifyAppRemote, result) { | ||
|
||
private val errorConnectSwitchToLocalDevice = "errorConnectSwitchToLocalDevice" | ||
|
||
private val connectApi = spotifyAppRemote?.connectApi | ||
|
||
fun switchToLocalDevice() { | ||
if (connectApi != null) { | ||
connectApi.connectSwitchToLocalDevice() | ||
.setResultCallback { result.success(true) } | ||
.setErrorCallback { throwable -> result.error(errorConnectSwitchToLocalDevice, "error when switching to local device", throwable.toString()) } | ||
} else { | ||
spotifyRemoteAppNotSetError() | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
```sh | ||
CLIENT_ID= | ||
REDIRECT_URL= | ||
CLIENT_ID=61b2332ab76d45918a33f91c3268ec1e | ||
REDIRECT_URL=comspotifytestsdk://callback | ||
``` |
Oops, something went wrong.