Let’s learn something “new”

Welcome Swaziland! (looking for some pics now) Moving up the coast!

Love the 360’s


Thank You Italy, and France, and of course China!

Ok, I actually wrote this like 3 or 4 years ago, but you probably haven’t seen anything like it.

A music remote for the iPhone using an android device.

Some advice, if you are just starting out learning how to program, pick something you love, no matter how saturated the app market, you want to learn not sell. I avoided making a mp3 player because, how was I going to make any money in the app store with that? It’s not about making money it’s about ideas and if you are working on something you love the ideas will flow faster than you can type.

There are two reasons why I can code in Android and iOS. The app I am about to show you and a lesson I learned when networks were just starting to be the hot item.

I was in support and Novell was starting to take off, everyone who knew networks knew Novell.

Then Microsoft came out with Windows NT and I chose that side because of course it was the coolest.

So some people chose Novell and got rich, some people chose Windows NT and got rich (I got screwed), but the people who got INSAAAAAAAAANELY RICH? They knew BOTH! and could make both talk to each other, so I said to myself if that opportunity ever happened again I wasn’t going to miss it.

So the other reason I know both is Steve Jobs was stubbornly (his company) not going to make the iPhone 6 Plus, he made the iPhone 5. It was then I knew he wasn’t going to make the phone I wanted, but I LOVED the sound chip in the iPhone for listening to music.

So I was going to have to make my own, I don’t do hardware so I was going to have to use software. I was going to pick the song with the beautiful screen on my Samsung phone along with huge cover art on the screen and have the iPhone actually play the music.

Thought I was going to use BlueTooth, but Apple has their own kind of BlueTooth so that was out. But I found Bonjour or Network Service Discovery on Android.


And now since we have the iPhone 6 Plus, 7 Plus, 8 Plus I guess I can show you how I did it.

This will be 3 apps, two iOS apps and one Android app.

First we will make an app to create a text file of all the songs on your iPhone.

Then a Android app that will take the list and make a selectable list that you can pick a song from.

Then the iOS app that actually plays the music.


First click on the app name in the tree view on the left and then click on build phases and add the following frameworks in the Link Binary with Libraries section.


Then add this code to the ViewController.m file:

#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>
#define NSLog(FORMAT, ...) printf("%s", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);

@interface ViewController ()


@implementation ViewController

- (void)viewDidLoad
    [super viewDidLoad];
    MPMediaQuery *everything = [[MPMediaQuery alloc] init];
    [everything setGroupingType: MPMediaGroupingArtist];
    NSArray *itemsFromGenericQuery = [everything items];
    for (MPMediaItem  *myArrayElement in itemsFromGenericQuery) {
        NSString *songTitle = [myArrayElement valueForProperty: MPMediaItemPropertyTitle];
        NSString *albmTitle = [myArrayElement valueForProperty:MPMediaItemPropertyAlbumTitle];
        NSString *songURL = [myArrayElement valueForProperty:MPMediaItemPropertyAssetURL];
        // We have to get same value twice to save as NSURL instead of String probably should
        // just convert a URL to String??
        NSURL *second = [myArrayElement valueForProperty:MPMediaItemPropertyAssetURL];
        AVURLAsset* audioAsset = [AVURLAsset URLAssetWithURL:second options:nil];
                CMTime audioDuration = audioAsset.duration;
        float audioDurationSeconds = CMTimeGetSeconds(audioDuration);
        NSDate* d = [NSDate dateWithTimeIntervalSince1970:audioDurationSeconds];
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
        [dateFormatter setDateFormat:@"HH^mm^ss"];
        NSString* result = [dateFormatter stringFromDate:d];
        NSLog(@"%@%@%@%@%@%@%@%@%@%@%@",albmTitle, @"*", songTitle, @"*",songURL, @"*",albmTitle,@".jpg*", result,@"*", @"\n");


- (void)didReceiveMemoryWarning
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.


YOU NEED TO ADD THE FOLLOWING TO YOUR Info.plist FILE: (right click and open as source code)

    <string>Make a song list for my app</string>

make sure you insert this in where there is a string line above and a key line below, you don’t want to separate the key from the string they are a pair.

This will give you a list with items separated by *
Nothing will show on the screen of the phone.

Back In Black*Hells Bells*ipod-library://item/item.m4a?id=4716459563742250917*Back In Black.jpg*00^05^12*
Back In Black*Shoot To Thrill*ipod-library://item/item.m4a?id=4716459563742250918*Back In Black.jpg*00^05^17*
Back In Black*What Do You Do For Money Honey*ipod-library://item/item.m4a?id=4716459563742250919*Back In Black.jpg*00^03^35*
Back In Black*Givin’ The Dog A Bone*ipod-library://item/item.m4a?id=4716459563742250920*Back In Black.jpg*00^03^32*
Back In Black*Let Me Put My Love Into You*ipod-library://item/item.m4a?id=4716459563742250921*Back In Black.jpg*00^04^15*
Back In Black*Back In Black*ipod-library://item/item.m4a?id=4716459563742250922*Back In Black.jpg*00^04^16*
Back In Black*You Shook Me All Night Long*ipod-library://item/item.m4a?id=4716459563742250923*Back In Black.jpg*00^03^30*
Back In Black*Have A Drink On Me*ipod-library://item/item.m4a?id=4716459563742250924*Back In Black.jpg*00^03^59*
Back In Black*Shake A Leg*ipod-library://item/item.m4a?id=4716459563742250925*Back In Black.jpg*00^04^06*
Back In Black*Rock And Roll Ain’t Noise Pollution*ipod-library://item/item.m4a?id=4716459563742250926*Back In Black.jpg*00^04^26*
The Razor’s Edge*Thunderstruck*ipod-library://item/item.m4a?id=4716459563742250957*The Razor’s Edge.jpg*00^04^52*
The Razor’s Edge*Fire Your Guns*ipod-library://item/item.m4a?id=4716459563742250958*The Razor’s Edge.jpg*00^02^53*
The Razor’s Edge*Money Talks*ipod-library://item/item.m4a?id=4716459563742250959*The Razor’s Edge.jpg*00^03^46*
The Razor’s Edge*The Razor’s Edge*ipod-library://item/item.m4a?id=4716459563742250960*The Razor’s Edge.jpg*00^04^22*
The Razor’s Edge*Mistress For Christmas*ipod-library://item/item.m4a?id=4716459563742250961*The Razor’s Edge.jpg*00^03^59*
The Razor’s Edge*Rock Your Heart Out*ipod-library://item/item.m4a?id=4716459563742250962*The Razor’s Edge.jpg*00^04^06*
The Razor’s Edge*Are You Ready*ipod-library://item/item.m4a?id=4716459563742250963*The Razor’s Edge.jpg*00^04^10*
The Razor’s Edge*Got You By The Balls*ipod-library://item/item.m4a?id=4716459563742250964*The Razor’s Edge.jpg*00^04^30*
The Razor’s Edge*Shot Of Love*ipod-library://item/item.m4a?id=4716459563742250965*The Razor’s Edge.jpg*00^03^56*
The Razor’s Edge*Lets Make It*ipod-library://item/item.m4a?id=4716459563742250966*The Razor’s Edge.jpg*00^03^32*
The Razor’s Edge*Goodbye & Good Riddance To Bad Luck*ipod-library://item/item.m4a?id=4716459563742250967*The Razor’s Edge.jpg*00^03^13*
The Razor’s Edge*If You Dare*ipod-library://item/item.m4a?id=4716459563742250968*The Razor’s Edge.jpg*00^03^09*

The * needs to be replaced with commas, but a lot of songs have commas in the title, so you need to remove those first before converting *’s to ,’s.

Also song titles have :’s in them so remove those before converting the ^’s to :’s.

ipod-library://item/item.m4a?id=4716459563742250957 – is the song on the iPhone.

If your actually going to try this, it’s best to grab just a few songs first so you can make sure the song’s don’t have any weird characters in them like @ for instance.

Copy and save it as a .txt file.

less successful, wow, did someone say that.

Leave a Reply

Your email address will not be published. Required fields are marked *