How to check existing of application on device? - java

I have just made application which requires BarCode scanner on device. How can I programatically check existing of this application into device? I know package name for BC scanner.

It is all documented on the zxing website.
http://code.google.com/p/zxing/wiki/ScanningViaIntent

I would suggest instead adding the scan functionality within your app, your app should never depend on other Apps to work.

Related

How to separate Social media application and Game application installed in the device

I create project in Android studio to display all application installed in my device, I want to separate the social media application and game application, is it possible? and any hints so i can do it.
Well, first of all, you should get all installed app package names then you can search package names in the play store to find out their category.
As I know there is no official API by play store so you should search and collect data from HTML and so on. also there should be some third-party APIs, just look for them and probably you will find some of them.
If you want to collect data from the play store, just take a look at this
Good luck!

Bluetooth scanning with app

I am making an app and was wondering does my app need to scan for Bluetooth devices? Because the phone itself already scans for devices.
Do I need to setup a scanner in my app to be able to use Bluetooth efficiently?
Or can i utilize the "scanner" from my phone?
The short answer is no, you do not need to write your own. Android has it's own discovery functionality built into the BluetoothAdapter class that you can utilize.
Check out this tutorial: http://code.tutsplus.com/tutorials/create-a-bluetooth-scanner-with-androids-bluetooth-api--cms-24084

Is it possible for an Android app to restrict other apps to WiFi only (without root)?

I was wondering if it was possible to make an android app (that does not require root) that could enable and disable the use of mobile data for other apps? I know there's a function to toggle background services per app inside the native Android settings, so maybe there's some public methods for me to do so with my own app.
Basically, I want my app to control whether other apps could access data via mobile data or WiFi only.
Pointing me to the right direction would be greatly appreciated as well.
Theoretically, yes.
See: https://github.com/android/platform_frameworks_base/blob/dbc51de44fe4f9a7f81528204250de32ec405d39/cmds/svc/src/com/android/commands/svc/DataCommand.java
This is the svc tool that can be launched via adb shell. It did error out with code 137 for me (unrooted Nexus 5), though. But from the code you see how this should theoretically work.
You retrieve the TelephonyManager and enableDataConnectivity, which is, of course, a hidden API (see: https://github.com/android/platform_frameworks_base/blob/6b8a3a52acf1c2722551f1ea1ce47831f87939cd/telephony/java/com/android/internal/telephony/ITelephony.aidl). Accessing hidden APIs is possible by recompiling the android.jar that you build against, or by using reflection (see: How do I build the Android SDK with hidden and internal APIs available?).
Hope this helps.

Error in LogCat while developing a barcode scanner for android

I followed the steps provided in the Zxing project. I have created a single button to scan a barcode. I am using emulator in Eclipse and I am having a webcam(according to the suggestion of #Sean Owen) which would do the image capture for me. While running the project after I click the scan button a prompt's asking whether I want to install an existing separate app named Barcode Scanner which is needed to begin the scan process. So, as soon as I choose the yes option the project crashes and shows that the application stopped working. Also I am having the following error in LogCat. Any help would be appreciated.
Its simple I guess. You don't have the Google Play app installed on your device. Either try to install it or find a device which has one installed.
You do not have the app that can handle the intent for barcode scanner.Go to the Google Play app and install one barcode scanner.Check if the issue persists

Zxing via intent

In my application I use the zxing library. I start de zxing barcodescanner via intent. But when the user has no barcodescanner installed. The application stops working. How can I check if a zxing barcodescanner is already installed?
There's a page on the zxing wiki that explicitly mentions this case:
How to scan a barcode from another Android application via Intents
The best way to integrate is to use the small library of code we have provided. It correctly handles for you many details, such as setting category, flags, picking the most appropriate app, and most importantly handling the case where Barcode Scanner is not installed.

Categories