I followed the demo app in the ACRCloud Android sdk. All the code for music recognition was in the activity.
I did the same but in a service. So can we initialize the ACRCloudClient in the service?(ACRCloudClient extends from Activity).
How can we then do it in the service if we can't.
I have the implementation code in the service in another question. Here is the link See this question
I checked the implementation of the ACRCloudClient and its extends android Activity. Also ACRCloudClient uses shared preferences(that's why I am getting a null pointer exception).
Since keeping a reference to an activity in a service is not a good Idea its best to Implement the above code in the activity. All the implementation of recognizing is being done in a separate thread anyway in the ACRCloudClient class so there is no point of creating another service for that.
I answered the same in another question as well link to related question