Advertisement
Guest User

Untitled

a guest
Jan 6th, 2013
1,725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. public void onCreate(Bundle savedInstanceState) {
  2. super.onCreate(savedInstanceState);
  3. setContentView(R.layout.main);
  4.  
  5. // für den Song
  6.  
  7. IntentFilter iF = new IntentFilter();
  8.  
  9.  
  10. iF.addCategory("ComponentInfo");
  11. iF.addCategory("com.spotify.mobile.android.service.SpotifyIntentService");
  12. iF.addCategory("com.spotify.mobile.android.service.SpotifyService");
  13.  
  14.  
  15. iF.addAction("com.spotify.mobile.android.ui.widget.SpotifyWidget");
  16. iF.addAction("ComponentInfo");
  17. iF.addAction("com.spotify");
  18. iF.addAction("com.spotify.mobile.android.service.SpotifyIntentService");
  19. iF.addAction("com.spotify.mobile.android.service.SpotifyService");
  20.  
  21.  
  22. iF.addAction("com.android.music.metachanged");
  23. iF.addAction("com.android.music.playstatechanged");
  24. iF.addAction("com.android.music.playbackcomplete");
  25. iF.addAction("com.android.music.queuechanged");
  26. iF.addAction("com.spotify.mobile.android.ui");
  27.  
  28. registerReceiver(mReceiver, iF);
  29.  
  30. // albumtext = (TextView) findViewById(R.id.albumText);
  31.  
  32. }
  33.  
  34. private BroadcastReceiver mReceiver = new BroadcastReceiver() {
  35.  
  36. @Override
  37. public void onReceive(Context context, Intent intent)
  38. {
  39.  
  40. Log.d("onReceive launched", "kekse");
  41.  
  42. String action = intent.getAction();
  43. String cmd = intent.getStringExtra("command");
  44.  
  45. String com = intent.getStringExtra("ComponentInfo");
  46.  
  47. Log.d("mIntentReceiver.onReceive ", action + " / " + cmd+ " / "+ com);
  48.  
  49. String artist = intent.getStringExtra("artist");
  50. String album = intent.getStringExtra("album");
  51. String track = intent.getStringExtra("track");
  52. Log.d("Music",artist+":"+album+":"+track);
  53.  
  54. Toast.makeText(context, "Command : "+cmd+"n Artist : "+artist+" Album :"+album+"Track : "+track+" " , Toast.LENGTH_SHORT).show();
  55.  
  56. }
  57. };
  58.  
  59. <?xml version="1.0" encoding="utf-8"?>
  60. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  61. package="de.KarlheinzMeier.SpotifyController"
  62. android:versionCode="1"
  63. android:versionName="1.0" >
  64.  
  65. <uses-sdk android:minSdkVersion="8" />
  66.  
  67.  
  68. <application
  69. android:icon="@drawable/ic_launcher"
  70. android:label="@string/app_name" >
  71. <activity
  72. android:name="de.KarlheinzMeier.SpotifyControllerActivity"
  73. android:label="@string/app_name" >
  74.  
  75. <intent-filter>
  76. <action android:name="android.intent.action.MAIN" />
  77. <category android:name="android.intent.category.LAUNCHER" />
  78. <category android:name="android.intent.category.ComponentInfo" />
  79. </intent-filter>
  80.  
  81. <receiver android:name="com.spotify.mobile.android.ui.widget.SpotifyWidget" android:label="Kekse">
  82. <intent-filter>
  83. <action android:name="com.spotify.mobile.android.service.SpotifyService" />
  84. <action android:name="com.spotify.mobile.android.service.SpotifyIntentService" />
  85. </intent-filter>
  86.  
  87. </receiver>
  88.  
  89. </activity>
  90.  
  91. </application>
  92.  
  93. </manifest>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement