草庐IT

Intent-Filter

全部标签

android - 在 AndroidManifest 中注册 Intent.ACTION_DREAMING_STARTED

所以我一直在尝试注册Intent.ACTION_DREAMING_STARTED在我的AndroidManifest中没有成功。......这里是接收者的定义。publicclassDreamingReceiverextendsBroadcastReceiver{@OverridepublicvoidonReceive(Contextcontext,Intentintent){Log.d("DreamingReceiver","Intent:"+intent.getAction());}}当daydream真正开始时,只是没有来自BroadcastReceiver的日志。但是,当我在A

android - 广播 PendingIntent 和 AlarmManager.setAlarmClock() 会丢失额外的 Intent

我像这样创建一个PendingIntent:Intentintent=newIntent(context,AlarmReceiver.class);intent.setAction("Foobar");intent.putExtra(EXTRA_ALARM,alarm);intent.putExtra(EXTRA_TRYTWO,tryTwo);intent.putExtra(EXTRA_BEGAN_TIME,beganTime);returnPendingIntent.getBroadcast(context,(int)alarm.getId(),intent,PendingInten

android - 如何让用户在 Android 中使用 Intent 只选择本地文件?

我需要让用户从他们的本地存储中为我的应用程序选择一个文件。现在我正在使用INTENT.ACTION_GET_CONTENT让用户选择文件,但它也提供了从云中选择URI的选项。获得URI文件后,我将其视为本地文件并执行各种操作(包括提取文件扩展名)。如何让用户只选择本地文件?elseif(menuItem.getItemId()==R.id.action_import_from_file){Intenti=newIntent(Intent.ACTION_GET_CONTENT);i.setType("*/*");startActivityForResult(Intent.createCh

android - Intent.FLAG_ACTIVITY_CLEAR_TOP 和 android 中的 finish 有什么区别

Android中的Intent.FLAG_ACTIVITY_CLEAR_TOP和finish()有什么区别? 最佳答案 这两者的区别如下:1.finish()您可以使用它来结束您现在正在进行的Activity,并且它会一次结束一项Activity。2.在FLAG_ACTIVITY_CLEAR_TOP的情况下,它将结束堆栈中当前Activity顶部的所有Activity。可能有多个Activity。 关于android-Intent.FLAG_ACTIVITY_CLEAR_TOP和andr

android - 将 startForeground() 与 Intent 服务一起使用

我正在尝试保持对屏幕开/关变化使用react的服务。该服务会在一段时间内完美运行,但最终会被终止。我现在正尝试使用startForeground()来使进程保持Activity状态,但它似乎仍然快要死了。我知道没有办法让一个进程永远活着,没有错误,但我觉得我一定做错了什么,因为添加startForeground()没有给进程增加额外的生命。另外,作为旁注,Logcat提示泄漏,因为未调用unregisterReceiver()(除非用户手动按下按钮)..但是,由于我要完成的事情的性质,接收器需要运行直到明确告诉停止。有什么建议吗?相关代码:publicclassUpdateServic

android - ACTION_BATTERY_CHANGED 服务 Intent

我正在使用此代码来跟踪我服务中的电池信息:Intenti=newContextWrapper(applicationContext).registerReceiver(null,newIntentFilter(Intent.ACTION_BATTERY_CHANGED));//nowyoucangetthelevelandscalefromthisintentvariableintlevel=i.getIntExtra(BatteryManager.EXTRA_LEVEL,-1);intscale=i.getIntExtra(BatteryManager.EXTRA_SCALE,-1)

android - 如何通过 Intent 播放 YouTube 视频?

在我的应用程序中,我想点击一个特定的按钮并跳转到youtube应用程序并显示一个youtube用户。例如http://www.youtube.com/user/punjabiradiousa.这怎么可能请建议一些技术? 最佳答案 这样做:startActivity(newIntent(Intent.ACTION_VIEW,Uri.parse("http://www.youtube.com/user/punjabiradiousa")));取自此处:AndroidYouTubeappPlayVideoIntent

android - Share Intent 不适用于将视频上传到 youtube

我正在尝试分享正在创建并存储在外部SD卡上的视频,其路径已被获取。Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath()我按如下方式使用SEND_INTENT:IntentshareIntent=newIntent(Intent.ACTION_SEND);shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);shareIntent.setType("video/mp4");shar

android - 通过 Intent 向多个电话号码发送短信

当我通过Intent发送短信时出现异常android.content.ActivityNotFoundException:NoActivityfoundtohandleIntent{act=android.intent.action.SENDTOtyp=vnd.android-dir/mms-sms(有额外的)请参阅下面的代码:-try{IntentsendIntent=newIntent(Intent.ACTION_SENDTO,Uri.parse("smsto:5551212;5551212"));sendIntent.putExtra("sms_body",sendSMSStri

android - 无法启动 GCM Intent 服务

大家好,我遇到了谷歌GCM,但出于某种原因,我的GCM互联网服务拒绝在注册事件中唤醒-我知道我做错了什么,我只是想不通是什么......这是我的list文件-和logcat输出-04-1806:53:39.561:D/PowerManagerService(2959):[api]handleWakeLockDeath:releaseWakeLock:PARTIAL_WAKE_LOCK'GCM_LIB'(uid=10218,pid=31431,ws=null)(elapsedTime=110364)04-1806:53:42.316:W/ActivityManager(2959):Una