Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- // für den Song
- IntentFilter iF = new IntentFilter();
- iF.addCategory("ComponentInfo");
- iF.addCategory("com.spotify.mobile.android.service.SpotifyIntentService");
- iF.addCategory("com.spotify.mobile.android.service.SpotifyService");
- iF.addAction("com.spotify.mobile.android.ui.widget.SpotifyWidget");
- iF.addAction("ComponentInfo");
- iF.addAction("com.spotify");
- iF.addAction("com.spotify.mobile.android.service.SpotifyIntentService");
- iF.addAction("com.spotify.mobile.android.service.SpotifyService");
- iF.addAction("com.android.music.metachanged");
- iF.addAction("com.android.music.playstatechanged");
- iF.addAction("com.android.music.playbackcomplete");
- iF.addAction("com.android.music.queuechanged");
- iF.addAction("com.spotify.mobile.android.ui");
- registerReceiver(mReceiver, iF);
- // albumtext = (TextView) findViewById(R.id.albumText);
- }
- private BroadcastReceiver mReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent)
- {
- Log.d("onReceive launched", "kekse");
- String action = intent.getAction();
- String cmd = intent.getStringExtra("command");
- String com = intent.getStringExtra("ComponentInfo");
- Log.d("mIntentReceiver.onReceive ", action + " / " + cmd+ " / "+ com);
- String artist = intent.getStringExtra("artist");
- String album = intent.getStringExtra("album");
- String track = intent.getStringExtra("track");
- Log.d("Music",artist+":"+album+":"+track);
- Toast.makeText(context, "Command : "+cmd+"n Artist : "+artist+" Album :"+album+"Track : "+track+" " , Toast.LENGTH_SHORT).show();
- }
- };
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="de.KarlheinzMeier.SpotifyController"
- android:versionCode="1"
- android:versionName="1.0" >
- <uses-sdk android:minSdkVersion="8" />
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name" >
- <activity
- android:name="de.KarlheinzMeier.SpotifyControllerActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- <category android:name="android.intent.category.ComponentInfo" />
- </intent-filter>
- <receiver android:name="com.spotify.mobile.android.ui.widget.SpotifyWidget" android:label="Kekse">
- <intent-filter>
- <action android:name="com.spotify.mobile.android.service.SpotifyService" />
- <action android:name="com.spotify.mobile.android.service.SpotifyIntentService" />
- </intent-filter>
- </receiver>
- </activity>
- </application>
- </manifest>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement