Android - How I can use OpenCV without install OpenCV Manager Application - android

Is there any way to run my app with OpenCV without install an extra application (OpenCV Manager)?
I can't ask my users to install an extra app to run my application.
Thanks.

Copy all the library's files.
Or simply install the manager within the app like:
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
.setDataAndType(Uri.parse("file:///path/to/org.opencv.engine.v2.14.apk"),
"application/vnd.android.package-archive");
startActivity(promptInstall);
add this permission:
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />

Related

How do I deal with the Agora exception "e/agora sdk cannot open log file for writing agorartm.log err=30"?

I use Agora as my RTM(Real Time Messaging) SDK, but after I set it up for Android develop, everything worked fine except for the problem that the RTMClientListener did not automatically update the messages received, and the debug console shows "e/agora sdk cannot open log file for writing agorartm.log err=30". Does anyone know how to fix this? Thanks in advance.
Try this:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
The lines above allow Android application read and write permission of external files Add this into AndroidManifest.xml file - before application tag:
package="com.example.yourproject">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application...
Regarding the Agora Flutter app, the example app only works with low security mode Agora projects. Token or primary certificate activated projects won't work with the example app. Go to Agora dashboard, create a new project with low security level - only APP Id type. Then try the example app with the new App id copied from the dashboard of new project.

Flutter APK Build

Goo day friends! I am new to Flutter and I have been experimenting on fetching data via REST API. On Android Studio, everything works just fine, so I suppose there's nothing wrong with my code.
Things I did to make sure my code works:
1.) Run the code in android simulator;
2.) Run the code using real device (enabling USB Debugging).
And it works just fine.
But when I build an apk file out of it and install it on my device, it no longer makes the API call (or is unable to?). I made it so, when the app runs initState(), it waits for the data to be loaded. While the data is not yet available, a CircularProgressIndicator() takes the entire screen.
If I run the app via the installed apk file, it's just CircularProgressIndicator(). Meaning, no data is being loaded and displayed. But when I run the code in AndroidStudio, the data is shown..
I am using http package. I'm not sure what I'm doing wrong, or what I'm missing.
Other things to note: I did not change anything in my AndroidManifest file, and just followed all the steps on building apk file in Flutter through the official documentation.
Like alexsanderfr said, this is indeed most of the time being caused by missing
<uses-permission android:name="android.permission.INTERNET" />
You shouldn't need
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
for REST API.
In Flutter, when debugging you implicitly have access to internet, however in release builds, you need to explicitly declare this permission.
update1
Ensure you have the http-package added to your pubspec.yaml file and that it's properly indented with two spaces:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: ^0.12.0+4
Did you add the internet permission to the manifest? If you're accessing the internet from an Android app you need to add the internet permission over the application tag.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

How to run install app in internal files dir?

I have some lines of code and apk file in internal cache dir:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(newFile(context.getCacheDir() + "/update.apk")), "application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
But I had a parsing error: "There was a problem parsing the package"
Thank You for helping!
Third-party apps, including the package installer, have no access rights to that file.
On Android N, they have finally fixed the problem with installing apps via a ContentProvider, like FileProvider. For versions prior to that, you can install from external storage, or maybe use MODE_WORLD_READABLE (deprecated, and banned on Android N) to allow that file to be read from internal storage.

How can you read from the public download directory from unity on an android

I'm trying to read from a file in Unity that I've written to the Downloads folder in Android.
I'm writing the file natively with another apk and I've copied the url that I wrote to: "/storage/emulated/0/Download/file" but when I try File.Exists(thatUrl) it's returning false.
So apparently the permission: <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> means something different in Unity than it does it the native Android SDK. Having that permission allows you to read from the INTERNAL storage as well as the external.

How to install application directly to device from web

I have one server, and on that server I have uploaded one apk file. There is a button on my webpage that, when clicked, the application should be directly installed to device instead of being downloaded to local storage.
I need same functionality like we install apps from google play store.
If any one knows this, then it will be appreciated.
I have not found any solutions of this through google.
Thanks.
This is not possible. Fortunately. Imagine the security breach this would be. Any Website could force install apps. This would open the doors for any kind of Virus.
You cannot do that as our friends advised you. I have tried by these ways for installing APK from my own server
You can download the APK from the server and save it in some folder
Add permission in manifest
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Use this demo code for downloading and installing the APK
Downloading APK from server
String PATH = Environment.getExternalStorageDirectory()+ "/yourpath/";
File file = new File(PATH);
if (!file.exists()) {
file.mkdirs();
}
File outputFile = new File(file,
"your.apk");
if (outputFile.exists()) {
outputFile.delete();
}
FileOutputStream fileOuputStream = new FileOutputStream(
outputFile);
fileOuputStream.write(bResponse);
fileOuputStream.close();
Installation of APK after Download completes
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment
.getExternalStorageDirectory()+ "/your path/"+ "yourapkname.apk")),
"application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
3.After Installation you can delete the APK from folder location
Any third party cannot install the application of their own on the Android Device directly. Otherwise they need some root permission that should be declared in device Kernel. Google Play can directly install by sending commands to Play Store to install the particular app as Google is in fact the owner of Android and indirectly Device Administrator which have full access to your device kernel.

Categories

Resources