Mada za sehemu hiiOptimising and deploying mobile appsMada 2
- Performing optimisation of mobile app
- Deploying the mobile app
Performing Optimisation of Mobile Apps
Mobile app optimisation is the process of improving an app's performance to make it faster, more efficient, and easier to use. When we optimise a mobile app, we reduce the amount of memory it uses, make it load faster, and help it use less battery. This creates a better experience for users and helps the app work well on many different devices.
Mobile devices have limited resources compared to desktop computers. They have smaller amounts of memory, less processing power, and batteries that can run out quickly. When an app is not optimised, it can:
- Take a long time to open or respond to user actions
- Drain the phone battery very quickly
- Freeze or crash unexpectedly
- Use too much mobile data
- Fill up the phone's storage
For example, a Tanzanian student using a smartphone with only 1GB of RAM will have a poor experience if they try to run an app that requires 500MB of memory just to start. Optimisation makes apps work on many types of devices.
1. Memory Optimisation
Memory (RAM) is used when an app is running. Too much memory use can cause the phone to run slowly or force other apps to close.
Techniques:
- Remove unnecessary data from memory when not needed
- Use efficient data structures
- Release resources when activities close
- Load only what is needed at the moment
2. Battery Optimisation
Apps that use too much processing power or keep the phone awake will drain the battery fast.
Techniques:
- Reduce background processing
- Use efficient algorithms
- Turn off sensors (GPS, WiFi, Bluetooth) when not needed
- Batch network requests instead of making many small ones
3. Speed and Load Time Optimisation
Users expect apps to open within a few seconds. Slow apps frustrate users.
Techniques:
- Load the main screen first, then load other content
- Compress images and other files
- Cache frequently used data
- Delay loading information that is not immediately visible
4. Network Optimisation
In Tanzania, many users have limited data plans. Efficient network use saves the user's money.
Techniques:
- Compress data before sending
- Reduce the number of network requests
- Use local storage to reduce repeated downloads
- Show cached content while loading new data
Profiling tools help us find where an app is slow or using too many resources. Android Studio Profiler is a common tool that shows:
- CPU usage — How much processing power the app uses
- Memory usage — How much RAM the app is using
- Network activity — How much data the app sends and receives
- Battery consumption — How much battery the app uses over time
When we run the profiler while using an app, it creates graphs that show peaks and problems. The areas with high CPU or memory are the places that need optimisation.
Imagine a simple app that displays a list of market items in Dar es Salaam. The original code loads all 500 items at once, downloads images for every item immediately, and keeps all data in memory.
Problem: The app freezes when opening and uses 300MB of RAM.
Optimisation steps:
-
Load only 20 items at first — The user sees items quickly. Load more when scrolling down.
-
Load images only when visible — Instead of downloading all images at once, download each image when it appears on the screen. Use a placeholder image first.
-
Cache data locally — Save the item list to the phone's storage. The next time the user opens the app, load the saved list first (instant display), then check for updates in the background.
-
Optimise the image sizes — If the phone screen is 720 pixels wide, do not load images that are 2000 pixels wide. Resize images to the needed size.
Result after optimisation:
- App opens in 1 second instead of 8 seconds
- Memory usage drops from 300MB to 80MB
- The app works on phones with only 1GB of RAM
When analyzing an app that needs improvement, look for these warning signs:
| Warning Sign | What It Means |
|---|---|
| App takes more than 5 seconds to open | Slow load time |
| Phone gets warm while using the app | High CPU usage |
| Battery drops quickly when app is idle | Background processing issue |
| App crashes when switching between screens | Memory leak |
| App uses mobile data even when offline | Unnecessary network requests |
To practice optimisation:
-
Run the app with Android Studio Profiler — Start the profiler before using the app. Perform common tasks like opening screens, clicking buttons, and scrolling. Watch the graphs for problems.
-
Identify the biggest problems — Look for the highest peaks in CPU and memory. These are your priority areas.
-
Apply one optimisation technique — Start with the biggest problem. For example, if memory is too high, add code to release unused data.
-
Test again with the profiler — After making changes, run the app again and compare the results. Has the problem improved?
-
Repeat — Continue fixing problems until the app performs well.
- Measure first, then optimise — Use the profiler to find the real problems. Do not guess.
- Optimise one thing at a time — Change one thing, then test. This helps you understand what works.
- Test on real devices — Emulators do not show battery problems. Test on an actual phone.
- Consider your users — A Tanzanian user with a cheap phone and limited data cares more about speed and data savings than fancy animations.
Mobile app optimisation makes apps faster, more efficient, and better for users. The main areas to focus on are memory usage, battery consumption, load speed, and network efficiency. By using profiling tools like Android Studio Profiler, we can find where an app has problems and apply the right fixes. Good optimisation helps apps work on many different devices, including older phones with limited resources.
In Tanzania, small businesses often use mobile apps to manage their shops or sell products online. If a shop owner in Mwanza uses an app to track their inventory and make sales, a well-optimised app will load quickly even on a cheap phone, use less battery so the phone lasts through a busy market day, and use less mobile data when checking prices or updating stock. This means the shop owner can rely on the app for their business without worrying about their phone running slow or running out of airtime quickly.
Jinsi utakavyotathminiwaTathmini ya mchakato · Tathmini ya matokeo · Tathmini ya maarifa
Tathmini ya mchakato
- Reduce app size by removing unused resources.
- Improve app responsiveness and memory usage.
- Test battery performance.
Tathmini ya matokeo
A mobile app that is lightweight, responsive, and energy-efficient.
Tathmini ya maarifa
Detailed knowledge of:
Method used: The student should explain how to
- optimize the mobile app using methods such as profiling, refactoring, and caching
Principles: The student should explain the principles of:
- reducing resource use and ensuring responsiveness.
Theories: The student should explain:
- the impact of algorithms, threading, and garbage collection in mobile app development.
Circumstantial knowledge:
Detailed knowledge about:
- platform-specific performance bottlenecks.
Swali
What is the main purpose of mobile app optimisation?
Ingia ili kuwasilisha jibu lako na lihesabiwe katika umahiri wako.
Ingia ili kufanya mazoeziMwalimu
Umekwama? Niulize chochote kuhusu mada hii.
Ingia ili kumuuliza Mwalimu wa AI wa Sonza kuhusu swali hili.
Ingia ili kuulizaMajadiliano
Hakuna maswali bado