【问题标题】:is it able to access android 11 system apps ,example messages是否能够访问 android 11 系统应用程序,示例消息
【发布时间】:2021-11-09 04:01:41
【问题描述】:
Intent launchFacebookApplication=getApplicationContext().getPackageManager().getLaunchIntentForPackage("com.google.android.apps.messaging");         
                    launchFacebookApplication.addCategory(Intent.ACTION_MAIN);     
                    startActivity(launchFacebookApplication);     

ComponentName compName=new ComponentName("com.google.android.apps.messaging","com.google.android.apps.messaging");
                       
               Intent intent=new Intent(Intent.ACTION_MAIN);   
                intent.addCategory(Intent.CATEGORY_LAUNCHER);    
                //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    
                intent.setComponent(compName);    
                startActivity(intent);     

and in manifest:-
<queries>
        <package android:name="com.google.android.apps.messaging"/>
    </queries>

并得到错误:-

PID: 2824
    android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.apps.messaging/com.google.android.apps.messaging}; have you declared this activity in your AndroidManifest.xml?

此代码有任何错误,请帮助我解决此问题

【问题讨论】:

    标签: android android-11


    【解决方案1】:

    不保证存在名为“com.google.android.apps.messaging”的应用。 OEM 和用户可以并且确实可以替换默认的 SMS 应用程序。 OEM 有时会在没有 Google 的 SMS 应用的情况下发货。如果您想发送短信,请使用 SMSManager 或使用通用短信意图启动它。检查launch sms application with an intentHow to open sms app via implicit intent? 并忽略任何设置组件名称的旧错误答案。

    另外,如果您想像变量名称所说的那样启动 Facebook,那不是 Facebook 应用程序的名称。也不能保证安装。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-02
      • 1970-01-01
      • 2021-10-12
      • 1970-01-01
      • 2016-02-03
      • 1970-01-01
      • 2012-02-05
      • 2020-10-04
      相关资源
      最近更新 更多