IoT Phone is React Native app making your iPhone fully featured IoT Device. It sends Accelerometer, Gyroscope, Magnetometer and Geolocation data via MQTT. It can be used as a showcase and playground for many fun apps, such as tracking your location or create own database of tracking data.
$ git clone https://github.com/j8/IoT-Phone.git
$ cd IoT-Phone/
$ npm install
npm start
Open the app in Xcode and AppDelegate.m file and change the following line with your IP address:
jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.10:8081/index.ios.bundle?platform=ios&dev=true"];
NSString *URLString = [NSString stringWithFormat:@"http://0.0.0.0:%zd/debugger-proxy?role=client", port];
Edit the file in iotphone/IoTPhone/node_modules/react-native-mqtt/ios/RCTMqtt/Mqtt.m and change the self.defaultOptions to your MQTT cridentials:
self.defaultOptions = @{
@"host": @"mqtt.relayr.io",
@"port": @1883,
@"protcol": @"tcp", //ws
@"tls": @NO,
@"keepalive": @120, //second
@"clientId" : @"T/BQQuGTfTzu88jG0q+C0Cw",
@"protocolLevel": @3,
@"clean": @YES,
@"auth": @YES,
@"user": @"fc1410b8-64df-4f3b-bcf2-31b4abe0b40b",
@"pass": @"mPb8AFT0npPe",
@"will": @NO,
@"willMsg": [NSNull null],
@"willtopic": @"",
@"willQos": @0,
@"willRetainFlag": @NO
};
MIT