3. Android
3.1 Project setup
3.1.1 Creating Android App Project
As
package name, you may want to register your own domain and use it. I did a search through GoogleDomainsand found “.net” and “.org” are both
available as 12$/year. “.com” is available from Google, but cost premium
$700+$12/year.
Will
focus on portrait
as more convenience for phone. For theme/style, refer below 3.2.11.
3.1.2 AndroidManifest
It
contains permission, sdk version, register service, receiver and
activity. Sample like this:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21"
/>
<uses-permission
android:name="android.Manifest.permission.KILL_BACKGROUND_PROCESSES"/>
<uses-permission
android:name="com.android.alarm.permission.SET_ALARM"/>
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"
/>
<uses-permission
android:name="android.permission.ACCESS_WIFI_STATE"
/>
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name="android.permission.INTERNET"
/>
<uses-permission
android:name="android.permission.ACCESS_SUPERUSER"/>
<uses-permission
android:name="android.permission.SET_DEBUG_APP"/>
<uses-permission
android:name="android.permission.RECORD_AUDIO"
/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
>
<activity
android:name="com.qyq.dog.MainActivity"
android:label="@string/app_name"
>
<intent-filter>
<action
android:name="android.intent.action.MAIN"
/>
<category
android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<service
android:name=".SpeechService"></service>
<!--
Register the Alarm Receiver -->
<receiver
android:name=".AlarmReciever"/>
<receiver
android:enabled="true"
android:name=".BootUpReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED"
/>
<category
android:name="android.intent.category.DEFAULT"
/>
</intent-filter>
</receiver>
</application>
For
version, API
level,
minSdkVersion,
targetSdkVersion,
refer to this.
As mentioned here:
compileSdkVersion
is your way to tell Gradle/ADT what version of the Android SDK to
compile your app with. Using the new Android SDK is a requirement to
use any of the new APIs added in that level. It should be emphasized
that changing
your compileSdkVersion does not change runtime behavior.
While new compiler warnings/errors may be present when changing your
compileSdkVersion, your compileSdkVersion is not included in your
APK: it is purely used at compile time. (You should really fix those
warnings though — they were added for a reason!). Therefore it
is strongly recommended that you always
compile with the latest SDK.
You’ll get all the benefits of new compilation checks on existing
code, avoid newly deprecated APIs, and be ready to use new APIs. Note
that if you use the Support
Library, compiling with the latest SDK is a requirement
for using the latest Support Library releases. For example, to use
the 23.1.1 Support Library, you must have a compileSdkVersion of at
least 23 (those first numbers need to match!). In general, a new
version of the Support Library is released alongside a new platform
version, providing compatibility shims to newly added APIs as well as
new features.
0 Comments:
Post a Comment