1

I am learning Implicit Intents. I am making an app to cover most of the implicit intent concepts, ScreenShot of this app is here.

enter image description here

In this App, I want to get access to device default Weather and Radio applications. But the problem is these two apps don't even have Application id. I have searched a lot to get the Application id of these two default apps in my device Oppo. And what if I run this application on another phone that has different application id so, how to solve this problem?

Both of these two applications are here:

enter image description here

Shoaib Kakal
  • 1,090
  • 2
  • 16
  • 32

1 Answers1

1

You can't open these apps like a browser with an implicit intent. Different manufacturers use different weather and radio apps. So, the only solution is to launch the app using the package name. To find out the package of the app you can use ADB or any package viewer app. For example, next one https://play.google.com/store/apps/details?id=com.csdroid.pkg&hl=uk

And then open the app with the next code.

public void openApp(Context context, String packageName) {
PackageManager packageManager = context.getPackageManager();
Intent launchIntent = packageManager.getLaunchIntentForPackage(packageName);

if (launchIntent != null) {
    context.startActivity(launchIntent);
} else {
    Toast.makeText(context, "Package not found", Toast.LENGTH_SHORT).show();
}}
Nazariy Pavlyk
  • 111
  • 1
  • 3
  • You mean, to access these two applications, I need to get help from 3rd party apps like package name viewer 2.0? Right? – Shoaib Kakal Apr 21 '20 at 04:50
  • As an option, you need to retrieve a package name of the app and I think that It will be easy and faster for you to use this app than to find a package using adb or device explorer. – Nazariy Pavlyk Apr 21 '20 at 08:18