Reputation: 31
I want to sendBroadcast to other app, the app package is com.android.cci the class is in folder engtest and name as FtmEngButtons, so which ComponentName setting should be correct
ComponentName("com.android.cci", "com.android.cci.engtest.FtmEngButtons");
ComponentName("com.android.cci.engtest", "FtmEngButtons");
ComponentName("com.android.cci", "com.android.cci.FtmEngButtons");
ComponentName("com.android.cci.engtest", "com.android.cci.engtest.FtmEngButtons");
Upvotes: 1
Views: 2721
Reputation: 2778
If you take a look at the documentation provided for ComponentName
, it states that "Two pieces of information, encapsulated here, are required to identify a component: the package (a String) it exists in, and the class (a String) name inside of that package."
So, in this ComponentName
constructor, the first argument is not the package name of the class but rather the package name of the application.
Based on this, the first option is the correct one --
ComponentName("com.android.cci", "com.android.cci.engtest.FtmEngButtons");
For Reference -- https://developer.android.com/reference/android/content/ComponentName.html
Upvotes: 1