草庐IT

android - 在 Android M 开发者预览版中找不到 PackageInstallerActivity

我有一个功能要实现:以编程方式安装apk。我正在使用的代码:ComponentNamecomp=newComponentName("com.android.packageinstaller","com.android.packageinstaller.PackageInstallerActivity");IntentnewIntent=newIntent(callingIntent);newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);newIntent.setComponent(comp);callingIntent包含来自另一个服务的

android - 具有隐式 Intent 的自定义权限

鉴于Android中的安全模型,我正在尝试对广播接收器使用自定义权限。我做了什么:我已经为接收者声明了自定义权限,从而限制了它可以接收的广播。list中的一些代码:现在我希望接收器UpdateUserReceiver将只接收来自使用权限“abc”的组件的广播。广播发送代码://Updateusername.Invokebroadcast.IntentupdateUserBroadcast=newIntent();updateUserBroadcast.putExtra("username",userName);updateUserBroadcast.setAction("android

android - 转弯多点路线导航 Google Maps Intent on Android

我正在寻找一种在Googlemap上打开精细导航的方法。我从this知道googlearticle它只能由起点和终点来定义。第一个选项(首选):我没有在Googlemap中找到任何完全符合我要求的Intent。有谁知道有没有?第二个选项:我尝试过其他方法来达到我想要的效果。我尝试在maps.google.com上创建自定义路线(从桌面浏览器)并从Android设备打开它。链接格式如下https://www.google.com/maps/dir/37.7851009,-122.4049193/37.7817261,-122.4008209/@37.7815141,-122.405992

android - 如何默认在 ActionOpenDocument Intent 中显示 "internal storage"选项

我需要用户选择他们从Windows文件资源管理器拖到他们的Android设备上的自定义文件类型的文件,但默认情况下内部存储选项不可用。当我使用它启动Intent时:varlibraryIntent=newIntent(Intent.ActionOpenDocument);libraryIntent.SetType("application/*");_activity.StartActivityForResult(libraryIntent,(int)ActivityRequestCode.ImportFeatureCodeLibrary);Android操作系统(5.1和6.0)显示以

android - android.intent.action.DOWNLOAD_COMPLETE 是显式广播吗?

我的应用程序(targetSdk=25)在list中定义了一个广播接收器,如下所示:每当Android的DownloadManager时,我的DownloadManagerReceiver都会收到通知完成文件下载,因此我可以对下载的文件进行一些处理。我正在努力将我应用的targetSdk迁移到27(Oreo)。根据https://developer.android.com/about/versions/oreo/background#broadcasts,通过list注册的隐式广播接收器不应该在AndroidO中工作(那些whitelistedexceptions除外)。但是,当我使用

android - 启动服务时是否需要添加 intent-filter?

我正在学习setupaservicetostartonboot的教程最后一段代码是:在AndroidManifest.xml中为该服务创建一个条目现在在BroadcastReceiverMyStartupIntentReceiver的onReceive方法中启动这个服务作为publicvoidonReceive(Contextcontext,Intentintent){IntentserviceIntent=newIntent();serviceIntent.setAction("com.wissen.startatboot.MyService");context.startServi

安卓 Facebook Intent

我正在使用此代码在Facebook上发帖,但它不适用于官方Facebook应用程序,因为它试图以链接形式发送。有什么办法解决这个问题吗?Intents=newIntent(android.content.Intent.ACTION_SEND);s.setType("text/plain");s.putExtra(Intent.EXTRA_SUBJECT,"Quote");s.putExtra(Intent.EXTRA_TEXT,qoute);startActivity(Intent.createChooser(s,"Quote")); 最佳答案

安卓 : How to avoid complete action using Dialog

我已经使用Intent使用Zxing库制作了Qr代码扫描仪,并且我在应用程序中保留了库,这样我的应用程序就不再需要条形码扫描仪了。但是,当条码扫描仪已经在操作系统中时,当我启动我的应用程序时,会出现一个对话框,要求完成操作使用:条码扫描仪或我的应用程序。当我在自己的应用程序中拥有所有库时,我该如何避免出现此对话框。请帮帮我。示例代码:Intentin=newintent("com.google.zxing.android.SCAN"); 最佳答案 使用:Intentintent=newIntent("com.google.zxing

Android 仅在 Activity 已经处于 Activity 状态时才将 Intent 传递给 Activity?

我有一个广播接收器,我想将其传递给一个Activity,但当且仅当该Activity可见时。我不想启动它,除非它已经可见。有这个选项吗?还是一种传递它但不让Activity可见的方法?或者,如果您知道将Activity注册为广播接收器的方法,我想也可以。 最佳答案 我认为您可以通过在onResume()中注册Receiver并在onPause()方法中取消注册receiver来存档它。这应该可以解决问题。 关于Android仅在Activity已经处于Activity状态时才将Inten

java - 放在 Intent/bundle 中的一些 Parcelables 对象可能会 self 干扰并影响 Intent/Bundle 的读取?

放在Intent/bundle中的一些parcelables对象可能会self干扰并影响Intent/Bundle的读取?我提取了我认为有问题的代码。此代码有效:publicvoidwriteToParcel(Parcelarg0,intarg1){arg0.writeParcelable(object1,arg1);arg0.writeTypedList(arraylist1);}publicvoidreadFromParcel(Parcelin){object1=in.readParcelable(object1.class.getClassLoader());arraylist1