44 | Chapter 1: Getting Started
www.it-ebooks.info
Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (9.04 MB, 688 trang )
Figure 1-26.
Figure 1-27.
Problem
App stores are a huge element of the attraction of modern smartphones. Unfortunately,
if you're developing on an emulated version 2.x Android, you can't currently use Google's Android App store.
Solution
SlideMe (http://slideme.org/) offers an alternative app store that works with verson 2.x
emulated Androids. This allows you to install other apps (perhaps you want to integrate
1.12 Installing apps onto an Android Emulator | 41
www.it-ebooks.info
with other apps), and also to test the experience of publishing and downloading your
own apps on your emulated Android. SlideMe also reaches many Android users who
are locked out of the Google Android App Store - like anybody from most of the world
who doesn't happen to live in the right country. It also allows publishing from outside
of the even smaller list of countries supported by Google's Android App Store.
Discussion
There are multiple links showing how to install the Android App Store onto an emulated Android so that you can use it to download apps to your emulated Android.
Unfortunately the only options I can find are for versions 1.6 or below of the Android
SDK platform.
One alternative I was able to find and use for my 2.1 SDK is Slide Me, an alternative
app store - it may not have as many apps as Google's Android App Store, but it does
work with my emulated Android.
Go to the web site using your emulated Android, browse or search through apps, and
click on a free one. After a pause to download, open the download (the little arrow on
the top left) and launch the .apk you've downloaded to install the app. I installed the
SlideMe app, after reviewing the license (typical stuff: it's licensed to me (I don't own
it) exclusively and non-transferably, and only if I accept ALL terms and conditions.
They get to include ads, if I want to buy apps there are further considerations, I have
to abide by all laws, no porn, no messing with SlideMe, no posting viruses, if it messes
anything up it's my problem, not theirs, SlideMe accepts no liability of any sort and
you indemnify them against that (nasty, but a mostly standard clause), etc.)
Once the SlideMe app is installed you can go through the catalog and install more apps
without using the browser. This is much easier, since the presentation is designed for
the Android. Chose a category, scroll through it, and chose an app to install. I have had
some stability problems using it on my emulator - it freezes on occasion - but I was able
to install some simple free apps like "Grocery list."
I noticed in the Android Invasion discussion forum on linkedin.com that many Android
users are disappointed to find that many cell phone providers do NOT include the app
store in their Android cell phone offering, and unless you're comfortable rooting and
flashing your Android phone there's no way to get it. Most consumers are NOT comfortable rooting and flashing their phones and for them SlideMe offers an alternative
way to find free and inexpensive apps for their phones.
SlideMe also allows you to publish your apps onto their app store, See (BROKEN XREF
TO RECIPE -1 'Publishing Your App on SlideMe').
See Also
The SlideMe Application Store.
SlideMe Upload for Developers.
42 | Chapter 1: Getting Started
www.it-ebooks.info
1.13 Android Epoch HTML/Javascript Calendar
Wagied Davids
Problem
Require a custom calendar using Javascript. Also shows how to interact between Javascript and Java.
Solution
Use a WebView component to load an HTML file containing the Epoch calendar javascript component. Steps involved:
• Download Epoch DHTML/Javascript calendar http://www.javascriptkit.com/
script/script2/epoch/index.shtml.
• Create an assets directory under your Android Project folder eg. TestCalendar/
assets/
• Code your main HTML file for referencing Epoch calendar
• Create an Android Activity for launching the Epoch calendar.
Note that files placed in Android assets directory are referenced like this: file:///android_asset/ (NOTE: triple leading slash and singular spelled asset )
Discussion
The solution - to make use of the WebView component for loading an HTML file
containing the Epoch calendar javascript component. To enable interaction between
the Javascript based view layer and the Java-based logic layer, a Java--Javascript bridge
interface is required, MyJavaScriptInterface inner class. The onDayClick() function
shows how to to call a javascript function from an Android actiivity eg. webview.loadUrl("javascript: popup();");
File: calendarview.html
Example 1-17.