Unexplained StreamLimitationException thrown on Android with Deezer SDK

176 Views Asked by At

I'm using the Deezer Android SDK. To first order I have things working, but occasionally it throws a "StreamLimitationException" with the explanation that the Deezer account is being used on another device. However, I know that the account is not being used on another device -- not on a mobile device, and not in a browser. I even changed the account password to make sure nobody else was using it.

I'm using the TrackPlayer. I've found that if I try to re-use the same track player for multiple songs, it doesn't work. So every time I want to play a new song, I call the stop() and then release() methods on the existing TrackPlayer, then obtain a new one.

The exception is thrown sometimes when I try to start playback on a new song. It appears random to me, in that I'm not aware of any fixed timeout with respect to the time the the DeezerConnect object was authorized. Furthermore, I'm trying to minimize the possibility of a timeout -- I've used both:

deezerConnect.setAccessExpires(Long.MAX_VALUE);

and

deezerConnect.setAccessExpires(0);

with no luck.

Additionally, I've tried periodically re-authorizing my deezerConnect object every few minutes, but that hasn't worked.

As one final attempt, I went into my account on the Deezer web site and deleted everything on the "My Apps" page. Then I re-enabled the app I'm working on. But I still hit the exception.

Does anyone have any suggestions for how to eliminate this problem?

Thanks!!

1

There are 1 best solutions below

0
On BEST ANSWER

This turns out to be an easy fix. DeezerConnect.authorize() takes a "permissions" argument. I changed mine from

    final String[] permissions = new String[] {
            Permissions.BASIC_ACCESS
    };

to

    final String[] permissions = new String[] {
            Permissions.BASIC_ACCESS,
            Permissions.OFFLINE_ACCESS // For no timeout
    };

As documented at https://developers.deezer.com/api/oauth.

Problem solved!