eymengunay / php-passbook

iOS passbook library for PHP
http://eymengunay.github.io/php-passbook/
MIT License
263 stars 53 forks source link

Relevance Information: Displaying Passes on the Lock Screen #36

Closed sameg14 closed 9 years ago

sameg14 commented 9 years ago

I need to be able to add relevant locations to the passbook file. How do you propose I go about doing this? This is what the JSON will look like

{
    ...
    "description" : "Example pass showing relevance information",

    "locations" : [

        {"latitude" : 37.3229, "longitude" : -122.0323},

        {"latitude" : 37.3286, "longitude" : -122.0143},

        {

            "altitude" : 10.0,

            "latitude" : 37.331,

            "longitude" : -122.029,

            "relevantText" : "Store nearby on 3rd and Main."

        }

    ],

    "relevantDate" : "2014-12-05T09:00-08:00"

}
sameg14 commented 9 years ago

Take a look at this URL for more details https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW53

eymengunay commented 9 years ago

@sameg14 You can use Location to achieve that.

Also, take a look at the relative test to see how to use it:

Here is a dummy example:

use Passbook\Type\EventTicket;
use Passbook\Pass\Location;

// Create an event ticket
$pass = new EventTicket("1234567890", "The Beat Goes On");
$pass->setBackgroundColor('rgb(60, 65, 76)');
$pass->setLogoText('Apple Inc.');

// Create a new location
$location = new Location(55.6819, 12.5642);
$pass->addLocation($location);

// Create another location
$location = new Location(34.0478, -118.2434);
$location->setAltitude(10);
$location->setRelevantText("Somewhere over the rainbow");
$pass->addLocation($location);
sameg14 commented 9 years ago

Awesome, you rock. Thanks man

eymengunay commented 9 years ago

I'm glad I was able to help! :)