How to implement the API Samples? (VoiceRecognition) - android

I am very new to Android development and I am trying to create a very basic app that makes use of the VoiceRecognition facility.
The resource site here says to just paste the sample code into the project:
http://developer.android.com/resources/articles/speech-input.html
However eclipse doesn't seem to find/like the line "import com.example.android.apis.R", what it underlines is the com.example part of it, and as a result all the "R." methods give errors (e.g. findViewById(R.id.list))....
Is there something that I am not doing? Am I supposed to set up the project in a particular way in order to use these code samples?
Thank you very much

Check that you have the Google APIs installed in your environment.
For each SDK version you target, you can choose to use the one with the Google APIs or not. Speech input utilises the Google APIs so you must have them installed and target them in your app and Eclipse.
EDIT:
Detailed instructions for using the Google APIs in Eclipse can be found on the Google Maps Overview page.
You'll need to pay particular attention to the Set up a new Android project section (which also covers reconfiguring an existing project) and Set up an Android Virtual Device. You may or may not need to reference the speech library in a similar way to the Add a uses-library element section.

Related

Need to integrate crashlytics in SDK made by us. how can i?

I want to identify the crashes in my SDK when some other apps integrate my SDK in their app.. during the use of my SDK in other apps, if crashes happen anywhere in my SDK code, then I want to identify that.
What are the ways to implement this type of integration in SDK?
To integrate Crashlytics you need to configure Firebase for your app package.
Since the app package is not your app package, but the package of the consumer of your SDK, it's impossible.
I believe there is an alternative way of doing so (check out Thread.setDefaultUncaughtExceptionHandler(...) and wrap the existing one), but I recommend, as been said in the comments, to check how you can legally do it.
I'm guessing (pure guess so don't take my word for it) that you need a written consent from you SDK customer and also runtime consent from the end user.
That being said - I strongly recommend not to do it.
Alternative legal way to do it:
Create an exception class, dedicated for your SDK. For example, if your SDK is called "My SDK" so create MySdkException.
Only throw MySdkException from within your SDK.
Embed libraries within your SDK and wrap their exceptions with MySdkException.
Don't obfuscate MySdkException.
The most important - kindly ask your SDK consumer to report any crashes caused by MySdkException.
Verify that your SDK customer asks the end-user to agree Crash report.

android - using AdMob in eclipse

I know there are different questions to this task, but I don't get much information about it.
I found out that AdMob is part of firebase now, but there's a way to use it without firebase. Besides there are no tutorials or information about eclipse - is it necessary to use Android Studio or is it just not documented?
Actually it does not matter if it is part of Firebase, because all of it belongs to the Google Play Services. To get the AdMob classes, you just need to add com.google.android.gms:play-services-ads:10.0.1 to your build.gradle file (see the full list of all possible services here) which already explains your second question.
Android development in Eclipse is not supported any more. There is no Eclipse plugin any more. Google forces you to take Android Studio now.

Is it possible to manage NokiaX and Android source code in the same source control and IDE?

I have several Android apps which I want to upload to Nokia X store.
Some of the apps can run on the phone without any modification needed.
However some of them which used android specific services such as GCM, Google Map needs to be replaced with Nokia Push Service and Nokia Map. (According to the apk test tool)
Now my question is:
is there a way that I can still manage both piece of source code in the same version control repository?
can I configure eclipse to build nokia-x apk or android apk by some configuration?
The reason is 95% of the code are shared. Only GCM and Google Map are handled differently.
It would be a pain if I put them in 2 repositories.
If you check the documentation provided at the nokia site. The OneApk sections for each API would be explaining excat steps to achieve this.
Dr.Jukka has good point as developer.nokia.com documentation is covering this question.
Just to summarize what documentation says:
You should use same source code and even same apk file.
You can runtime-check if here maps are available and based on that select correct MapActivity or MapFragment: http://developer.nokia.com/resources/library/nokia-x/here-maps/one-apk-with-here-maps-and-google-maps.html
You can runtime-check if you should use GCM or Nokia Notifications by trying to use GCM and if it gives UnsupportedOperationException, you can catch that and use Nokia Notifications: http://developer.nokia.com/resources/library/nokia-x/nokia-notifications/one-apk-with-nokia-notifications-and-google-cloud-messaging.html

Is there a way to get application icon (by a given package) from the web?

I know it is not pure android question, but i'll try anyway.
Im building a website where I get package name of many applications (which is on the market).
I need a way to give a package name, and get back its icon.
Is there a way to do this?
from the market? apprain? or any other link
something like getting the favicon by this link:
http://g.etfv.co/https://facebook.com
http://g.etfv.co/https://google.com
thanks in advance
The terms of use prevents the use of robots or other web scrapers:
Blockquote
3. Your Use of Google Play
...
3.3 You agree not to access (or attempt to access) Google Play by any means other than through the interface that is provided by Google, unless you have been specifically allowed to do so in a separate agreement with Google. You specifically agree not to access (or attempt to access) Google Play through any automated means (including use of scripts, crawlers, or similar technologies) and shall ensure that you comply with the instructions set out in any robots.txt file present on the Google Play website.
You should take a look at this API for the Android Market
http://code.google.com/p/android-market-api/
Or you could try to scrape the page (probably like this api does) but why do the work if it is already done...

Android minSdkVersion

I've programmed my app with Eclipse and android 2.2. However I think that my app would work for previous version and so it would allow more users to use my app. The problem is that I'm not sure... for instance I'm using Gestures which I think is a more recent feature... but otherwise I'm just using some Button, ListView, and WebView.
So is there a way to detect automatically the Minimum Sdk Version needed ( by checking which function my app is using) ?
I can't download the SDK of each previous version of android and test it until it doesn't work ...
Thanks
I can't download the SDK of each previous version of android and test it until it doesn't work ..
Why cant you? This is what the rest of us do. Create various different Emulators and test it out. I've released many apps by testing this way.
Take a look at the Compatibility page on Android's developer website.
It has some great information on how to make sure your application will work on different versions of Android and how to stop users from downloading the application if they do not have the right features on their device. In your case that would be the gestures feature.
To manage this, Android defines
feature IDs. Every capability has a
corresponding feature ID defined by
the Android platform. For instance,
the feature ID for compass is
“android.hardware.sensor.compass”,
while the feature ID for Live
Wallpapers is
“android.software.live_wallpapers”.
Each of these IDs also has a
corresponding Java-language constant
on the PackageManager class that you
can use to query whether feature is
supported at runtime.
To be totally sure you have to test your app against every platform version you target. Otherwise users of your app will do it for you (and that might be not good for app rating).
On the https://developer.android.com/about/dashboards/index.html page you can see the latest up-to-date platforms share info. So just decide how many potential users you're going to leave without your app :)

Categories

Resources