ufcfx5-15-3mobile device development android development sdks and publishing
TRANSCRIPT
UFCFX5-15-3Mobile Device Development
Mobile Device Development
Android Development SDKs and Publishing
UFCFX5-15-3Mobile Device Development
Agenda
Create an Android Project with Eclipse User interface design Start Another Activity Saving and loading Data Access to website Building, Testing and Debugging Preparing marketing materials for publishing Publish app to Google play
UFCFX5-15-3Mobile Device Development
Project Basic Setting
• Application name: Should be checked with Google play first. Can be changed after publishing
• Package name: Unique and permanent. Can not be changed after publishing
• Minimum required SDK: Should be as low as possible to support more devices.
• Target SDK: Should be the latest version of android or most popular android version
UFCFX5-15-3Mobile Device Development
Android Manifest File Filename: AndroidManifest.xml Declaring permissions Declaring activity Declaring version code and number Declaring device filters
<supports-screens> <uses-feature> <supports-gl-texture>
UFCFX5-15-3Mobile Device Development
Design UI Using Graphical Layout
Drag & Drop
Visual Design
No coding is required
UFCFX5-15-3Mobile Device Development
Supporting Multiple Screens
Screen Size Metrics Physical screen size (10, 7, 5, 4, 3.5 inches ) Screen density in dpi (dots per inch): low, medium, high, and extra
high Screen resolution
Filter out devices (minimum screen size) Different layouts for different screen sizes Different bitmap drawables (e.g. icons) for different
screen densities Different layouts for different screen orientation
UFCFX5-15-3Mobile Device Development
Start Another Activity Triggers for starting
Button pressed Hand gestures Key pressed
HelpBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent;
intent.putExtra("LanguageChoice",LangChoice);
intent = new Intent(AnatomyQuizLite.this, HelpActivity.class);
startActivity(intent);}
});
UFCFX5-15-3Mobile Device Development
Android storage spaces Internal storage
Always available No permission needed Files saved here are accessible by only your app by default When the user uninstalls your app, the system removes all your
app's files from internal storage.
External storage (SD card or USB storage) It's NOT always available Writing permission must be declared It's world-readable, so files saved here may be read outside of your
control. When the user uninstalls your app, the system removes your app's
files from here only if you save them in the directory from getExternalFilesDir()
UFCFX5-15-3Mobile Device Development
Write and read in internal storage
Write a fileFileOutputStream fOut = openFileOutput("test.txt", Context.MODE_PRIVATE);
String str = "data";
fOut.write(str.getBytes());
fOut.close();
Read a fileFileInputStream fis;
fis = openFileInput("test.txt");
StringBuffer fileContent = new StringBuffer("");
byte[] buffer = new byte[1024];
while ((n = fis.read(buffer)) != -1)
{ fileContent.append(new String(buffer, 0, n)); }Fis.Close();
UFCFX5-15-3Mobile Device Development
External Storage Directory Find the base directory File baseDir = Environment.getExternalStorageDirectory();
Create App data folderFile StoreDir = new File (baseDir.getAbsolutePath() + "/AppName/");
if( !StoreDir.exists() ) StoreDir.mkdirs();
Create a filename with absolute data folder pathFile dataFile = new File(StoreDir, ”test.txt”);
UFCFX5-15-3Mobile Device Development
Access to Website The simple way is to use IntentString text = “Android”;
Intent intent = new Intent(Intent.ACTION_VIEW);
String url = "http://en.wikipedia.org/w/index.php?search=";
url += text;
intent.setData(Uri.parse(url));
startActivity(intent);
Use WebviewwebView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://www.google.com");
UFCFX5-15-3Mobile Device Development
Building the app Use command prompt to build the app
Export App as an unsigned apk file from Eclipse Create a signing key file using keytool
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Sign the apk file
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name
Align the apk file
zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk
UFCFX5-15-3Mobile Device Development
Testing the app Distribute App to test users
Use ADB to install from PC to android devices
adb -d install YOURAPK.apk Email the apk to test users
Need to set permission for installing app from the unknown source Use Alfa or Beta option in Google developer console
Tests using real devices Run through as many devices as possible (different manufacturer,
different screen size, low-end and high-end devices) Memory consumption tests using DDMS Screen orientation test Phone call test
UFCFX5-15-3Mobile Device Development
Preparing marketing materals
Screenshots Use monitor.bat to capture screenshots from devices Device art generator (from Google) to warp app screen shot in real
device artwork Can add promotion texts in the screen shot
Description texts Short description with key features Use special characters as bullet points Include as many as keywords Include good user reviews
UFCFX5-15-3Mobile Device Development
Publish app in Google Play Register as an individual developer
A valid credit card for verification purpose One-off $25 registration fee Publish free and paid apps
Set up a website for your app Facebook page is OK Need to be mobile compatible website
Understand Google play policy No adult content No Spam keywords No fake reviews
UFCFX5-15-3Mobile Device Development
Using Google Services Use Admob as advertisement platform
Use Google Game service leaderboards Unlock achievements
Use Google App licensing service
Use multiple APK support
Use Apk expansion files
UFCFX5-15-3Mobile Device Development
Android Development Resources
Official android development resource API guides Example projects Tutorials
Technical questions Get answer from Google Watch for stackoverflow.com for answers
XDA developer Android forum www.xda-developers.com
UFCFX5-15-3Mobile Device Development
Publish other markets Amazon appstore
Submit the android app without modification except links to Google play
Majority devices are Kindle fire tablets (Kindle phone?) Allow price promotion
Samsung apps Submit the android app without modification except links to Google
play (before 1st July, 2014) Have to rewrite some of codes in Samsung SDK.
BlackBerry App World Accept android app but the app have to be resigned
UFCFX5-15-3Mobile Device Development
Summary
• Eclipse have android project wizard and activity wizard to help developer to generate a skeleton android project.
• Developers have to consider different screen sizes for the design of user interface. Multiple UI layouts are encouraged for tablets and phones. Also if the app supports both portrait and landscape views, two different UI layouts should be used.
• Store private data in internal storage. But they will be eased if users uninstall the app.
• To make android users happy, you have to run through as many android devices as possible to test your app. The device list should include tablets and phones, devices without SD cards and devices have low memory and slow CPU.