I am working on an android wear project, I am facing an issue while opening the dialing activity via intent. The problem is that Intent is opening the call history instead of the dial pad.
Code snippet
val callIntent = Intent(Intent.ACTION_DIAL)
callIntent.data = Uri.parse("tel:0526722293")
context.startActivity(callIntent)
I have checked different stack-overflow post but still facing the same issue.
Can we make calls to any number in Android Wear 2.0?
How to make a phone call using intent in Android wear?
Is there anything that, I have to do more for android wear
If you are testing the app one an emulator, try the same on a physical watch. If the issue still persists, you might want to check the following:
Do the app have required permissions
Is this specific to a device/OS version
Ref:
https://developer.android.com/guide/topics/connectivity/telecom/selfManaged#constraints
https://developer.android.com/wear/releases?hl=ko
Related
I was following along to TheNewBoston Android App Development for Beginners - 63 - Styles video for pushing notifications.
The app works perfectly in Android Studio's emulator, but when I run the app on my phone, the notifications won't show up.
Is there a reason notifications work on the emulator, but not an actual device?
in some devices like Huawei you need to make your app as protected app to use notification feature. you can use below code to detect Device Model and make decision to go to the protected app setting.
String PhoneModel = android.os.Build.MANUFACTURER;
if ("huawei".equalsIgnoreCase(PhoneModel)) {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity"));
startActivity(intent);
}
Shortly after I posted the question I figured out what the problem was. I updated my phone to Oreo recently and was trying to use the old way (the way thenewboston did it inside his videos). Apparently for android Oreo you have to code notifications with channels, the old way for notifications is not compatible with Oreo.
I am using MediaStore.Audio.Media.RECORD_SOUND_ACTION to open sound recorder application, I am not able to open application as no default application present, then i install two voice recorder application even though not able to see these application in my chooser intent. I am using following code-
Intent soundRecorderIntent = new Intent(); // create intent
soundRecorderIntent.setAction(MediaStore.Audio.Media.RECORD_SOUND_ACTION); // set action
startActivityForResult(soundRecorderIntent, ACTIVITY_RECORD_SOUND); // start activity
It works well in marshmallow
The code is correct and you've probably found an app that supports the intent by now. But to prevent that others waste their time like I did, here's a quick note:
Most of the currently top rated voice recording apps in the Play Store do not provide the necessary intent filter.
That seemed so unrealistic to me that I doubted my code when it didn't work after having installed the five most popular voice recording apps. But there's a handy manifest viewer app that reveals that their manifests simply do not declare the intent filter. So, as said, the code is correct.
To save you the time from searching for a suitable app, here are two that are invocable:
Audio Recorder from Sony
Samsung Voice Recorder from Samsung
There is no requirement for a voice recorder app to support this Intent action, and apparently your device does not ship with an app that supports this Intent action either. Your code itself seems fine.
If recording is optional to your app, catch the ActivityNotFoundException and tell the user that they do not have a recorder, and perhaps suggest to them that they install one that you test that works, if you can find one.
Otherwise, record the audio yourself, using MediaRecorder.
I want to use ACTION_OPEN_DOCUMENT on my Xiaomi Device. I tried
this google sample, but it also not working. With code below i can normally run on Samsung galaxy s4.
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(intent, 42);
Im getting "android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUMENT_TREE }" error.
Xiaomi screwed up, apparently. AFAIK, they're not Google Play certified, so they do not need to pass the CTS. There is nothing you can really do about it, other than to detect this case (e.g., use PackageManager and queryIntentActivities(), or catch the ActivityNotFoundException) and fall back to whatever you do on pre-Android 4.4 devices.
I saw the same error occur on Xiaomi MI 6X with Android 10.
Upon some digging I realized that some devices allow the user to disable the "Files" app from Google Play Services (or might even do that by default). Thus, I would recommend first prompting user for enabling "Files" app and/or updating the Google Play Services. Please note, that on most devices the "Files" app is hidden from the user, thus it will not be present on app list in preferences.
I am looking for a way to automatically open an application on Android. Something like QTP on windows. I read about quite a few testing tools for Android that need the phone to be connected to the laptop via USB. Is it possible to code an android application that can open another specific application on the device automatically?
I understand that if it is my application or an open source one, I can get the UI element and perform click or type into it automatically using code but how can I access UI elements of other apps on the device.
Example: My app should be able to open my phone keypad and type in a number or open an app like Truecaller and type into the textview on main screen? Something like web automation but for Android device. Any help would be appreciated! Thank you!
You can use Intents:
//consider context as being the Context of your current app
PackageManager packageManager = context.getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage(PACKAGE_NAME);
context.startActivity(intent);
device.wait(Until.hasObject(By.pkg(PACKAGE_NAME)), 10000); //this is a UiAutomator method to wait for the application to be started (or 10 seconds).
You can also use solo UiAutomator methods: open the apps menu, click on the app icon. You can see an example here
Hi guys this is just my first post,
is it possible to access an activity which is in Phone.apk in a non-rooted phone?
I've tried something like this
Intent i = new Intent(Intent.ACTION_MAIN);
i.setClassName("com.android.phone", "com.android.phone.PhoneApp");
startActivity(i);
but my app always stops unexpectedly.
There is no activity named com.android.phone.PhoneApp in the Android firmware, let alone in the Android SDK.
Moreover, you should not be attempting to start activities in the com.android package, as they are not part of the Android SDK and may or may not exist on any given device or Android version.