While executing the code below I can not find in You com.mediatek.bluetooth In the form of a package name instead of com.android.bluetooth . Obviously, new Android versions use this package. It worked for me com.android.bluetooth Android 4.2. On 1 I see a single piece of code in 4.1.2 in the
com.android.bluetooth list. Is this version problem or device problem?
PackageManager pm = getPackageManager (); & Lt; ResolveInfo & gt; AppsList = pm.queryIntentactivities (in, 0); If (appsList.size () & gt; 0) {// Select Bluetooth String package name = zero; String classname = null; Boolean found = false; (ResolveInfo information for: appsList) {Toast. Maketext (Main Activity: This, PackageName, Toast. LNNGHHORT). Show (); Package name = info.activityInfo.packageName; If (packageName.equals ("com.android.bluetooth")) {className = info.activityInfo.name; Found = true; the break; // found}} if ((found!) {Toast. Make text (this, "not found", toast. LNGHHARART). Show (); // exit} else {in.setClassName (package name, classname); (In) startActivity; }}
No comments:
Post a Comment