Skip to main content

Command Palette

Search for a command to run...

Developing the McCance Surfacing Contractors In-House App Using Java for iOS

Published
•2 min read•View as Markdown
Developing the McCance Surfacing Contractors In-House App Using Java for iOS

Introduction

In today’s digital landscape, having a dedicated in-house mobile application can significantly enhance business operations, improve workflow efficiency, and streamline customer interactions. This technical blog outlines the development of the McCance Surfacing Contractors’ in-house app using Java for the iOS platform, avoiding the use of JavaScript.

Choosing the Right Approach

Since iOS development is primarily supported through Swift and Objective-C, developing an iOS app using Java requires an alternative approach. One effective solution is leveraging GraalVM Native Image or RoboVM to compile Java code into native iOS binaries.

Development Stack

  • Programming Language: Java

  • Framework: RoboVM (or an alternative JVM-based tool like Codename One)

  • Database: SQLite for local storage

  • Networking: Retrofit for API calls

  • Build Tools: Gradle/Maven

  • IDE: IntelliJ IDEA or Android Studio (with RoboVM plugin)

Setting Up the Environment

  1. Install RoboVM: RoboVM allows Java applications to run natively on iOS.

    • Download and install RoboVM.

    • Configure it with your Java environment.

  2. Create a New Java Project:

     mkdir McCanceSurfacingApp
     cd McCanceSurfacingApp
    
  3. Configure Gradle: Define dependencies in build.gradle.

     plugins {
         id 'java'
     }
     dependencies {
         implementation 'com.squareup.retrofit2:retrofit:2.9.0'
         implementation 'org.xerial:sqlite-jdbc:3.36.0'
     }
    

Key Features & Implementation

1. User Authentication

Implement authentication using Firebase Authentication SDK for Java.

public class AuthenticationService {
    public boolean login(String username, String password) {
        return username.equals("admin") && password.equals("password");
    }
}

2. Job Scheduling and Management

Using SQLite for storing project schedules and job details.

public class JobScheduler {
    private Connection connection;
    public JobScheduler() throws SQLException {
        connection = DriverManager.getConnection("jdbc:sqlite:mccance.db");
    }
    public void addJob(String client, String location, String date) throws SQLException {
        String sql = "INSERT INTO jobs (client, location, date) VALUES (?, ?, ?)";
        PreparedStatement stmt = connection.prepareStatement(sql);
        stmt.setString(1, client);
        stmt.setString(2, location);
        stmt.setString(3, date);
        stmt.executeUpdate();
    }
}

3. Live Project Tracking

Utilizing Retrofit for API-based project status updates.

public interface ApiService {
    @GET("/projects/status")
    Call<ProjectStatus> getStatus();
}

Testing and Deployment

  • Testing: Use JUnit and RoboVM’s iOS simulator for debugging.

  • Deployment: Package the application using RoboVM’s build tool and submit it to the Apple App Store via Xcode.

Conclusion

Developing an iOS application using Java is achievable with frameworks like RoboVM, allowing McCance Surfacing Contractors to have a robust, native-feeling app without relying on JavaScript. This approach ensures maintainability, performance, and scalability while keeping the development ecosystem within the Java stack.

More from this blog

M

McCance Group Code

29 posts