Unexplained StreamLimitationException on Android with Deezer SDK
I am using Deezer Android SDK. In the first order everything works for me, but sometimes it throws a "StreamLimitationException" explaining that the Deezer account is being used on another device. However, I know that the account is not being used on another device - not a mobile device, not a browser. I even changed the account password to make sure no one is using it.
I am using TrackPlayer. I found that if I try to reuse 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 () methods, then release () on the existing TrackPlayer, and then I get a new one.
The exception is thrown sometimes when I try to start playing a new song. This seems random to me as I don't know of a single fixed timeout relative to when the DeezerConnect object is allowed. Also, I'm trying to minimize the possibility of a timeout - I've used both:
deezerConnect.setAccessExpires(Long.MAX_VALUE);
and
deezerConnect.setAccessExpires(0);
no luck.
Also, I tried to periodically re-authorize my deezerConnect object every few minutes, but it didn't work.
As one of the last attempts, I logged into my account on the Deezer website and deleted everything on the My Apps page. Then I re-enabled the application I am working on. But I still got caught in the exception.
Does anyone have any suggestions on how to fix this issue?
Thank!!
source to share
This turns out to be an easy solution. 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 described at https://developers.deezer.com/api/oauth .
Problem solved!
source to share