Jump to content

Poweramp API Lib and Sample Applications (updated for v3)


admin
 Share

Recommended Posts

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 2 weeks later...
  • 4 weeks later...
  • 1 month later...
  • 10 months later...

Здравствуйте. Я пишу плагин для часов Sony SmartWatch для управления Poweramp'ом и возникла загвоздка с отображением обложки. Когда дисплей телефона включен я получаю BroadcastIntent(ACTION_AA_CHANGED) через powerampApi(и соответственно успешно отображаю обложку на часах), но если телефон заблокировать(или он сам потушит экран по таймауту) - Intent c ACTION_AA_CHANGED powerampApi больше не посылает. Хотя, например, ACTION_TRACK_CHANGED я получаю даже с отключенным дисплеем.

Я так понимаю это сделано в целях экономии энергии или же ACTION_AA_CHANGED отсылавется не сервисом. Как можно обойти эту проблему?

Спасибо.

Link to comment
Share on other sites

  • 4 weeks later...

poweramp_api_lyrics_proto

This is prototype application utilizing Poweramp AA (Album Art) widget functionality. AA Widget is basically sort of app widget in Poweramp Album art area in main player screen. It's possible to display almost everything the app widget developer wants, and get user interaction events back in the app.

Poweramp manages multiple AA widgets internally and shows appropriate UI for them - Close button (which remembers it's state), and selectable icons to switch between AA widgets.

Example use of AA widgets are providing song lyrics, song extended information (e.g. pulled from internet), artist/album info, etc.

[attachment=0]api_example_lyr.png[/attachment]

The download for this seems to have dissapeared - could you upload/link it again? I'd like to play with adding an AA widget but have no idea how without the example!

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Hi.

I have some trouble with API.

Sometimes player cant send broadcast

03-27 17:49:46.564: WARN/BroadcastQueue(399): Failure sending broadcast Intent { act=com.maxmpz.audioplayer.AA_CHANGED flg=0x10 (has extras) }

android.os.TransactionTooLargeException

at android.os.BinderProxy.transact(Native Method)

at android.app.ApplicationThreadProxy.scheduleRegisteredReceiver(ApplicationThreadNative.java:1009)

at com.android.server.am.BroadcastQueue.performReceiveLocked(BroadcastQueue.java:373)

at com.android.server.am.BroadcastQueue.deliverToRegisteredReceiverLocked(BroadcastQueue.java:439)

at com.android.server.am.BroadcastQueue.processNextBroadcast(BroadcastQueue.java:487)

at com.android.server.am.BroadcastQueue$1.handleMessage(BroadcastQueue.java:140)

at android.os.Handler.dispatchMessage(Handler.java:99)

at android.os.Looper.loop(Looper.java:137)

at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1485)

Can you help me?

Link to comment
Share on other sites

  • 11 months later...
  • 10 months later...

Hello. i'm trying to solve one problem with Poweramp control from external app.

So the task is to toggle play / pause, forward and other actions from another application.
On the first sight there is something in PowerampAPI.java:
 

/**	 * Poweramp Control action.	 * Should be sent with sendBroadcast().	 * Extras:	 * 	- cmd - int - command to execute.	 */	public static final String ACTION_API_COMMAND = "com.maxmpz.audioplayer.API_COMMAND";

Ok, great, seems that this is what i'm looking for.
So i put that in my code:
 

Intent poweramp_intent = new Intent("com.maxmpz.audioplayer.API_COMMAND");poweramp_intent.putExtra("cmd",3);MainActivity.this.sendBroadcast(poweramp_intent);

It didn't work. Then i read carefully some examples from Poweramp.apiexample.
There are some explicit intents there, like this:

startService(new Intent(PowerampAPI.ACTION_API_COMMAND).putExtra(PowerampAPI.COMMAND, PowerampAPI.Commands.TOGGLE_PLAY_PAUSE));

But i'm not very familiar with android, and it seems to me that that isn't very possible to create such explicit intent from the other application. 
So what is the most tru way to controll Poweramp from external apps?

 

Same story in russian:
Добрый день. Не подскажите, какой самый правильный способ управлять Poweramp'ом из стороннего приложения? Согласно PowerampAPI.java

можно послать броадкаст и я попытался сделать это, но не сработало. 
Я так же не уверен, что из стороннего приложения можно послать explicit intent к Poweramp api. По крайней мере у меня не получилось, делал так:

Intent pwramp_intent =   new Intent(PowerampAPI.ACTION_API_COMMAND);pwramp_intent.putExtra(PowerampAPI.COMMAND, PowerampAPI.Commands.TOGGLE_PLAY_PAUSE);startService(pwramp_intent);

и оно валится с:

 java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.maxmpz.audioplayer.API_COMMAND (has extras) }

Возможно я просто неправильно собираю интент.

В какую сторону покопать? 

 

 

 

UPD:
Deal with it.

Since 5.0.1 all intents to startService must be explicit.

So the right way to construct intent is smth like this
 

 

Intent pwramp_intent = new Intent(PowerampAPI.ACTION_API_COMMAND);pwramp_intent.setPackage(PowerampAPI.PACKAGE_NAME);pwramp_intent.putExtra(PowerampAPI.COMMAND, PowerampAPI.Commands.TOGGLE_PLAY_PAUSE);startService(pwramp_intent);

 

 

 

Link to comment
Share on other sites

  • 1 year later...
On 3/29/2011 at 6:26 PM, admin said:

The code is available here: https://github.com/maxmpz/powerampapi


Changes:- PowerampAPI and Sample app updated with Scanner API support. This is supported by Poweramp build 551+.- Updated reference resources to match build 550+v. 1.2- now available on Github- package name is now com.maxmpz.Poweramp- added Widgetpack base classesv. 1.1- fixed few seekbar issuesv. 1.0- initial release

 

Link to comment
Share on other sites

Poweramp API Sample App is update to all recent PowerampAPI changes, they are pretty minor, except Album Art:

- album art now is not sent as bitmap within Intent
- original album art (embed - from track file itself, or cached downloaded album art) is provided via specific Poweramp Content provider

This allows hi-res images in apps utilizing PowerampAPI, but may require additional image processing (e.g. scaling / subsampling / etc. )

Also API + Sample App was tested / polished on Androids up to 9.

Link to comment
Share on other sites

In trying to load the powerampapi_example into Android Studio, the following error occurs

Error:Content is not allowed in prolog.

Looking at the log, the following line is repeated many times

Caused by: org.xml.sax.SAXParseException; systemId: file:/C:/Users/Theo.Enermax/Downloads/powerampapi-master/poweramp_api_example/poweramp_api_lib/src/main/AndroidManifest.xml; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

 

the content of the above manifgest.xml is 

../../../../poweramp_api_lib/AndroidManifest.xml


Any advice?

Link to comment
Share on other sites

6 hours ago, flyingdutchman said:

Given I cannot get the sample app to run, I copied the createPlaylistAndAddToIt() routine.

Stepping though this, the Playlist is created without any issues. However, inserting into this playlist still fails with an unknown Uri message.

image.png.daf51e2586e0d13b46d436c8c14cb701.png

Is it me or is there still an issue?

You need Poweramp 795+ build.

Link to comment
Share on other sites

  • 2 months later...

Hi,

If you unload from the Poweramp system, when you open the example API, it immediately drops or when you press PLAY

Build 804

com.maxmpz.Poweramp.apiexample E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.maxmpz.Poweramp.apiexample, PID: 23110
    android.app.RemoteServiceException: can't deliver broadcast
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1881)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6938)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...