A modern Android marketplace application that enables users to buy and sell items in a secure, user-friendly mobile environment. Built with native Android development and powered by a PHP backend API.
MobileMarket is a comprehensive e-commerce mobile application designed to facilitate peer-to-peer trading. Users can register, authenticate, browse items, post their own products for sale, and interact with a dynamic marketplace ecosystem. The app features a clean, intuitive interface with real-time data synchronization and robust user management.
- Secure Registration & Login: Complete user authentication system with session management
- Token-based Security: JWT-like token system for secure API communications
- Persistent Sessions: Auto-login functionality with secure token storage
- Browse Items: View all available items with search and filtering capabilities
- Item Details: Comprehensive item information including ratings, descriptions, and seller details
- Post Items: Easy-to-use interface for listing items for sale
- Top-Rated Items: Featured section showcasing highest-rated products on the home screen
- Material Design: Clean, modern interface following Android design guidelines
- Bottom Navigation: Intuitive navigation between Home, Browse, and Post sections
- RecyclerView Integration: Smooth scrolling and efficient data display
- Search Functionality: Real-time search with keyword filtering
- Responsive Design: Optimized for various Android screen sizes
- Live Updates: Real-time synchronization with backend database
- Rating System: Community-driven item rating and feedback system
- Dynamic Content: Automatically updated listings and user data
- Language: Java
- Minimum SDK: API 24 (Android 7.0)
- Target SDK: API 34 (Android 14)
- Architecture: MVVM pattern with Data Binding
- Server: PHP-based REST API
- Database: MySQL database for data persistence
- Hosting: LAMP stack (Linux, Apache, MySQL, PHP)
- API Endpoints: RESTful services for all app functionality
- Volley: HTTP library for network requests
- Material Design Components: Modern UI components
- AndroidX Navigation: Fragment navigation architecture
- Data Binding: Two-way data binding for UI
- RecyclerView: Efficient list display
- CardView: Material design card layouts
Before setting up the project, ensure you have:
- Android Studio: Latest version (recommended: Arctic Fox or newer)
- Java Development Kit (JDK): Version 8 or higher
- Android SDK: API level 24-34
- Git: For version control
- Web Server: Apache/Nginx with PHP support (for backend)
- MySQL Database: Version 5.7 or higher
git clone https://github.com/SindyMl/Mobilemarket.git
cd Mobilemarket-
Open in Android Studio:
- Launch Android Studio
- Select "Open an existing project"
- Navigate to the cloned repository folder
- Select the project and click "OK"
-
Gradle Sync:
- Android Studio will automatically prompt for Gradle sync
- Wait for the sync to complete (may take several minutes on first run)
-
SDK Requirements:
- Ensure Android SDK platforms 24-34 are installed
- Install any missing dependencies suggested by Android Studio
-
Configuration:
- Update API endpoints in the Java files if hosting backend elsewhere
- Current endpoints point to:
https://lamp.ms.wits.ac.za/home/s2669198/
-
Web Server Configuration:
# For Apache on Ubuntu/Debian sudo apt update sudo apt install apache2 php mysql-server php-mysql # For Windows (XAMPP recommended) # Download and install XAMPP from https://www.apachefriends.org/
-
Database Setup:
CREATE DATABASE d2669198; USE d2669198; -- Create users table CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) UNIQUE NOT NULL, password VARCHAR(255) NOT NULL, email VARCHAR(255) UNIQUE NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); -- Create items table CREATE TABLE items ( item_id INT AUTO_INCREMENT PRIMARY KEY, seller_id INT NOT NULL, name VARCHAR(255) NOT NULL, description TEXT, price DECIMAL(10,2) NOT NULL, rating DECIMAL(3,2) DEFAULT 0.00, date_posted TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (seller_id) REFERENCES users(id) );
-
PHP Files Deployment:
- Copy all PHP files to your web server directory (e.g.,
/var/www/html/orhtdocs/) - Update database credentials in PHP files:
$username = "your_db_username"; $password = "your_db_password"; $database = "your_db_name";
- Copy all PHP files to your web server directory (e.g.,
-
API Endpoints:
login.php- User authenticationregister.php- User registrationget_items.php- Retrieve marketplace itemspost_item.php- Add new itemsrate_item.php- Rate and review items
-
Update API URLs:
- Open
MainActivity.java,LoginActivity.java, etc. - Replace URL constants with your server endpoints:
private static final String LOGIN_URL = "https://your-domain.com/api/login.php";
- Open
-
Network Security:
- For development with HTTP, add to
AndroidManifest.xml:
<application android:usesCleartextTraffic="true">
- For development with HTTP, add to
-
Database Connection:
- Update
mobileMarket.phpand other PHP files with your database credentials - Ensure MySQL service is running
- Update
-
CORS Configuration (if needed):
header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); header("Access-Control-Allow-Headers: Content-Type, Authorization");
- Connect an Android device or start an emulator
- Click "Run" in Android Studio or use:
./gradlew installDebug
- Start your web server and MySQL service
- Test API endpoints:
curl -X GET "http://your-domain.com/get_items.php"
- Registration: Create a new account with username, email, and password
- Login: Access your account with registered credentials
- Browse: Explore available items in the marketplace
- Search: Use the search functionality to find specific items
- Post Items: List your own items for sale with descriptions and pricing
- Rate Items: Provide feedback and ratings for purchased items
- Home Tab: View top-rated items and welcome dashboard
- Browse Tab: Search and filter through all marketplace items
- Post Tab: Add new items to the marketplace
app/
βββ src/main/java/com/example/mobilemarket/
β βββ MainActivity.java # Home screen with top items
β βββ LoginActivity.java # User authentication
β βββ RegisterActivity.java # User registration
β βββ BrowseItemsActivity.java # Item browsing and search
β βββ PostItemsActivity.java # Item posting interface
β βββ DetailsActivity.java # Item detail view
β βββ Item.java # Item data model
β βββ ItemAdapter.java # RecyclerView adapter
β βββ ui/ # UI fragments and components
βββ src/main/res/
β βββ layout/ # XML layout files
β βββ values/ # Colors, strings, styles
β βββ drawable/ # Images and icons
βββ build.gradle # App dependencies and configuration
-
Generate Signed APK:
- In Android Studio: Build β Generate Signed Bundle/APK
- Follow the wizard to create/use a keystore
-
Optimize Build:
android { buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
- Input Validation: All user inputs are validated on both client and server
- SQL Injection Prevention: Prepared statements used in all database queries
- Authentication: Token-based authentication for API security
- HTTPS: Use HTTPS in production for secure data transmission
- Password Security: Implement proper password hashing (bcrypt recommended)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue on GitHub
- Contact the development team
- Check the documentation for common solutions
- v1.0.0 - Initial release with core marketplace functionality
- Features: User authentication, item browsing, posting, and rating system
Built with β€οΈ using Android Studio and modern development practices