A social networking mobile application that enables users to discover and connect with nearby peers using Bluetooth Low Energy (BLE) technology. The app facilitates real-time messaging and peer management through a hybrid mobile app built with Cordova and a PHP backend for authentication and data storage.
This repository contains two main components:
cloud.crossed/: Cordova-based mobile application for iOS, Android, and browser platformswww.crossed.cloud/: PHP web application handling Google OAuth authentication and user profile management
- Bluetooth Peer Discovery: Uses BLE to detect and connect with nearby devices
- Real-time Messaging: Send and receive messages between connected peers
- Google OAuth Integration: Secure user authentication via Google accounts
- Profile Management: Store and retrieve user profiles with images
- Cross-platform Support: Runs on iOS, Android, and web browsers
The mobile app is built using:
- Framework: Apache Cordova with Onsen UI for the interface
- Plugins:
cordova-plugin-bluetoothle: BLE communicationcordova-plugin-background-mode-bluetooth-*: Background BLE operationscordova-plugin-camera: Photo capturecordova-plugin-uniquedeviceid: Unique device identification
- BLE Service: Custom service UUID
76202B97-51E8-40BC-B6F7-B7D440935FFEwith characteristic51001225-1CF0-475F-93DB-D61B38200898
The web component handles:
- Authentication: Google OAuth 2.0 flow
- Profile Storage: JSON files stored in
core/prof/directory - API: RESTful endpoints for peer and message management
- Node.js and npm
- Cordova CLI:
npm install -g cordova - PHP 7+ with Composer
- MySQL database
- Google Cloud Console project with OAuth credentials
-
Clone and navigate:
cd cloud.crossed -
Install dependencies:
npm install
-
Add platforms:
cordova platform add ios cordova platform add android
-
Configure API server: Update the
servervariable inwww/js/index.jsto point to your API endpoint. -
Build the app:
cordova build ios cordova build android
-
Run on device/emulator:
cordova run ios cordova run android
-
Navigate to web directory:
cd www.crossed.cloud -
Install PHP dependencies:
composer install
-
Configure Google OAuth:
- Create a project in Google Cloud Console
- Enable Google+ API
- Create OAuth 2.0 credentials
- Download
client_secrets.jsonand place in the root directory - Update redirect URIs to match your domain
-
Set up database:
- Create MySQL database named
apidb - Import the schema from
cloud.crossed/api/api.sql - Update database credentials in
api/api.php
- Create MySQL database named
-
Deploy to web server:
- Ensure PHP sessions are enabled
- Configure CORS headers if needed
- Set up SSL for production
The mobile app communicates with the PHP backend via HTTP POST requests.
All endpoints accept POST parameters and return JSON responses.
- Endpoint:
api.php - Parameter:
getpeer=1,id=<user_id> - Response:
{"image": "<image_url>"}
- Endpoint:
api.php - Parameter:
getstatus=1,id=<user_id> - Response:
{"peers": [<peer_ids>], "msgs": [<messages>]}
- Endpoint:
api.php - Parameters:
mkpeer=1,fromid=<user_id>,toid=<peer_id> - Response: Updates peer lists for both users
- Endpoint:
api.php - Parameters:
rmpeer=1,fromid=<user_id>,toid=<peer_id> - Response: Removes peer connections and associated messages
- Endpoint:
api.php - Parameters:
sendmsg=1,fromid=<user_id>,toid=<peer_id>,msg=<message_text> - Response: Adds message to recipient's message queue
- Endpoint:
api.php - Parameters:
getmsg=1,id=<user_id> - Response:
{"msgs": [<message_objects>]}
id(VARCHAR): Unique user identifierimage(TEXT): Profile image URLpeers(TEXT): JSON array of connected peer IDsmsgs(TEXT): JSON array of pending messages
- JavaScript: Follow standard ES5 practices
- PHP: Use procedural style with mysqli
- HTML/CSS: Onsen UI components
- Test BLE functionality on physical devices
- Verify OAuth flow in web browser
- Check API responses with tools like Postman
- Mobile: Submit to App Store and Google Play
- Web: Deploy to hosting service with PHP support
- Fork the repository
- Create a feature branch
- Make changes and test thoroughly
- Submit a pull request
[Specify license if applicable]
For issues and questions, please create an issue in this repository. /Users/ntilau/Repos/Crossed/README.md