Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Here's a basic example using all the methods
var icloud = require("find-my-iphone").findmyphone;

icloud.apple_id = "steve@jobs.com";
icloud.password = "oneMoreThing";
icloud.password = "oneMoreThing";

icloud.getDevices(function(error, devices) {
var device;
Expand All @@ -54,7 +54,7 @@ Here's a basic example using all the methods
console.log("Driving time: " + result.duration.text);
});

icloud.alertDevice(device.id, function(err) {
icloud.alertDevice({deviceID: device.id, subject: 'node.js demo'}, function(err) {
console.log("Beep Beep!");
});

Expand Down Expand Up @@ -91,11 +91,7 @@ find(email,password[,label[,callback]])
* password (required): Your iCloud password
* label (optional): The label of the phone you want to alert (iCloud accounts may have multiple devices). The label can be found under "All Devices" in the Find My iPhone app. If there are multiple phones with the same label, the last one matching will be alerted. You should rename devices to be unique.
* callback (optional): A function to execute when the phone has been alerted

# Tests

`apple_id=someone@gmail.com apple_password=somePassword mocha test`




26 changes: 19 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,26 @@ var findmyphone = {
callback(error, devices);
});
},
alertDevice: function(deviceId, callback) {
var options = {
url: findmyphone.base_path + "/fmipservice/client/web/playSound",
json: {
"subject": "Amazon Echo Find My iPhone Alert",
"device": deviceId
alertDevice: function(options, callback) {
var url = findmyphone.base_path + "/fmipservice/client/web/playSound";
if ('object' === typeof(options) && options.hasOwnProperty('deviceID')) {
options = {
url: url,
json: {
"subject": options.subject || "Amazon Echo Find My iPhone Alert",
"device": options.deviceID
}
}
};
}
else { // backwards compatibility for deviceId string provided
options = {
url: url,
json: {
"subject": "Amazon Echo Find My iPhone Alert",
"device": options
}
};
}
findmyphone.iRequest.post(options, callback);
},
getLocationOfDevice: function(device, callback) {
Expand Down