Microsoft translator error on Android app - android

I'm trying to use Microsoft Translator for an Android app but it keeps throwing the same exception of "access":
"**java.lang.Exception: [microsoft-translator-api] Error retrieving translation : datamarket.accesscontrol.windows.net**"
Basically I'm running it on Android 2.3, I'm using the Java API ( https://code.google.com/p/microsoft-translator-java-api/ ), and I have registered for the translator in the Windows Azure Marketplace ( https://datamarket.azure.com/developer/applications/register ).
My core code is the following
Translate.setClientId("MY CLIENT ID");
Translate.setClientSecret("MY CLIENT SECRET");
try {
String translatedText = Translate.execute(word, Language.ENGLISH, Language.PORTUGUESE);
tvTranslation.setText(translatedText);
}
catch (Exception e) {
tvTranslation.setText(e.getMessage());
}
I even downloaded and ran this project, but got the same error: https://github.com/boatmeme/microsoft-translator-java-api
And this as well: http://mycodeandlife.wordpress.com/2013/02/05/android-tutorials-language-translator-app/
Any ideas? I spent the whole day on it and couldn't get anywhere.

This was very basic, but I found out the error was due to the (lack of the) Internet permission on Android.
Just needed to add it to my manifest:
<uses-permission android:name="android.permission.INTERNET"/>

Related

Not able to apply Policy of Android Enterprise

I am creating an app with the use of Android Enterprise.
For that, I added dependencies in the build.gradle file.
implementation 'com.google.apis:google-api-services-androidmanagement:v1-rev84-1.25.0'
I am trying to disable uninstalling application using below code from here
try{
Policy policy = new Policy();
policy.setUninstallAppsDisabled(true);
} catch (Exception e) {
e.printStackTrace();
}
But above code is not working. No any Exception or Warning arise
What I am missing? Not able to found proper documentation that how to use Enterprise Management API.
Using the client library of the Android Management API from an Android app is not enough the manage the device the app is running on. You need to first set up the device as managed. For that you can follow the instructions in the quickstart guide.

App crashes on Launch when made as system application

I developed an application that uses DJI SDK. When installed as an system application it crashes on Launch because its not able to load the libraries. It works fine when installed as normal application.
Steps followed to make system application
1)Rooted the device
2)Copied the .apk file to system/app directory
3)Rebooted the device
4)App was installed as default application but crashed on Launch
After commenting out the following line related to DJI SDK and followed the same steps as above. It worked fine as system app.
Helper.install(context);
The implementation of Helper class which is in DJI SDK is as below:
public static void install(Application app) {
Object var1 = null;
try {
System.loadLibrary("DexHelper_sdk");
if (PPATH != null) {
System.load(PPATH);
}
} catch (Error var3) {
;
}
String app_dataDir = app.getApplicationInfo().dataDir;
DexInstall.install(app, new File(app_dataDir + "/.cache_sdk/sdkclasses.jar"));
}
As far as my understanding the crash is because the system is failing to load the libraries.
My gradle looks similar as in the following link:
https://github.com/dji-sdk/Mobile-SDK-Android/blob/master/Sample%20Code/app/build.gradle
this issue has been fixed since 4.6 version of Android MSDK, pls try to update to the later version, right now the 4.7.1 has been released.

How to obtain code coverage from manual testing on android application (Android studio and gradle)

Currently, I'm researching about GUI automated testing on Android and for some reason, I need a tool that can generate code coverage report from manual testing.
After a long searching, I found that Jacoco and Emma mention the manual approach on their website.
But unfortunately, There is not any up-to-date-working example on the internet.
I have tried a lot of suggesting solution, for example, https://groups.google.com/forum/#!searchin/jacoco/manual$20android%7Csort:date/jacoco/vx0g_6TKY8Q/0Tg3fX84CAAJ .
It generated a coverage.exec but the file's size was only few byte (of course, Jacoco failed to generate any report from it.)
Here is what I have tried: https://github.com/kindraywind/MyDummy
In app/build.gradle
apply plugin: 'jacoco'
jacoco {
toolVersion ="0.7.8+" //I did try "0.7.4+" as the suggest.
}
task jacocoTestReport(type: JacocoReport) { … }
In jacoco-agent.properties
destfile=/storage/sdcard/coverage.exec
In app/src/main/AndroidManifest.xml`
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
In MainActivity.java
protected void onStop()
{
super.onStop();
if(BuildConfig.DEBUG)
{
String TAG = "jacoco";
try {
String covPath = Environment.getExternalStorageDirectory().getPath() + "/coverage.exec";
File coverageFile = new File(covPath);
Class<?> emmaRTClass = Class.forName("com.vladium.emma.rt.RT");
Method dumpCoverageMethod = emmaRTClass.getMethod("dumpCoverageData",coverageFile.getClass(), boolean.class, boolean.class);
dumpCoverageMethod.invoke(null, coverageFile, true, false);
} catch (Exception e) {
}
}
}
The emulator is Nexus 5 API 19 (I did try most of the versions.)
The log from device
EMMA: runtime coverage data merged into [/storage/sdcard/coverage.exec] {in 8 ms}
The log after run ./gradlew jacocoTestReport
Unable to read execution data file /Users/MyDummy/app/coverage.exec
I'm using OSX10.12.3 if it related.
To sum up, I need to know (or any working example) how to obtain code coverage while:
Test the app manually.
On Android application.
Which is using Gradle not Maven or Ant.
Android Studio not Eclipse.
I see no way out and would really appreciate a help.
I've provided a detailed how-to guide on how to obtain code coverage during manual testing at my blog. Following it you should obtain a code coverage report. You seem to be headed in the right direction, but please read the post thoroughly.
A bit more advanced and complete solution is described in another blog post. It uses NanoHttpd to create a REST server on the device/emulator. The API provides a single endpoint that writes the report file as a response. Additionally, a custom (much faster) CSV report writer is provided.
Feel free to contact me if you want to discuss GUI automated testing (related to Android) further :)

Acr.Biometrics Xamarin plugin

I create Xamarin.Forms app and use Acr.Biometrics plugin. In PCL I check available finger print for device.
private async void AvailableBiometric()
{
bool available = await Biometrics.Instance.IsAvailable();
lblStatus.Text = available ? "Yes" : "No";
}
When I launch my app on Windows 10 emulator (UWP project), I get result false ("NO") and it's correct. But when I launch app on Android 6.0 (Emulator or real device with finger authorization), I get Exception "".
I find source code this plugis on GitHub. My Exception generate this plugin's code:
I don't understand what do I wrong and why for Windows app this Exception did not generate. If who know, please, help me.
I don't understand what do I wrong and why for Windows app this Exception did not generate.
I tried to only install Acr.Biometrics Package to PCL, and debugged UWP project. It also threw the exception.
If you want to use lib of Acr.Biometrics in Android and UWP platform,
please make sure you have installed Acr.Biometrics nuget package to Android and UWP project.
You can right click your solution--> Manage NuGet Package for solution-->select the Installedbutton-->left click Acr.Biometrics NuGet Package.
Check the xxx.Droid project option.And then press the install button. The installation is done later.
For Android support, you need to add the following to your AndroidManifest.xml:
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
Usage
In your shared/PCL library, simply check if the sensor is available:
protected async override void OnAppearing()
{
base.OnAppearing();
if (await Biometrics.Instance.IsAvailable())
{
var success = await Biometrics.Instance.Evaluate("Your custom message");
if (success)
{
//do some stuff
}
}
}

Open an xls file with HSSFWorkbook crash my app in run time

When I do this:
try {
workbook = new HSSFWorkbook(new FileInputStream(mInputFile))
} catch (Exception e) {
...
}
My android project work in debug time but crash in run time.
I Use apache POI 3.9
I suspect it could because of the missing java.rmi.UnexpectedException
Thanks Gagravarr..
As metioned on this http://poi.apache.org/changes.html link, "Avoid using RMI based exception from PropertySetFactory, as it's not needed nor helpful" is been fixed in Version 3.10-FINAL (2014-02-08).
Use, 3.10 Final or upper version to get rid of 'java.rmi.UnexpectedException' error.
It looks like a mistake in PropertySetFactory - there's no reason for it to be using a RMI exception, as there's no RMI involved. My hunch is that it's the RMI class that's confusing Android.
I've raised this as bug #55901, and it's fixed as of r1551832. If you grab a nightly build from tomorrow, or do a SVN checkout and build yourself, it ought to now be fixed.

Categories

Resources