Tag: android-intent

How to make the app's broadcast receiver keep listening without having a service running in the background

I’m trying to make an android application which listens to wifi change broadcast and do some action. But the problem is that it is not working when the process is killed. I found this question which says that it won’t work without an activity How to create BroadcastReceiver without Activity/Service? So that is not an […]

Android Intent Data Uri Query Parameter

I am trying to launch my app using an intent like this: adb shell am start -a android.intent.action.VIEW -d “my_scheme://my_host?queryParam1=QueryParam1&queryParam2=QueryParam2″ (I have registered for the data intent filter with scheme “my_app_scheme” and host “my_host”) But when I do getIntent().getData() all I get is the URI “my_scheme://my_host?queryParam1=QueryParam1” Only the first ever query param is set in […]

How to tell what's the MIME type according to the file?

Is there any elegant way (not just if (“fileExt”.compareTo(“.mp3”)) {MIME_TYPE = “audio/*”}) to learn programatically the MIME type that should be put into an intent, with which I have to open the file? Thanks!

How to avoid black screen on startActivity when FLAG_ACTIVITY_CLEAR_TASK is set?

I am launching a new activity using the following: Intent intent = new Intent(this, MyNewActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); overridePendingTransition(0, 0); While MyNewActivity is launching, a black screen is shown. If I remove Intent.FLAG_ACTIVITY_CLEAR_TASK, the activity is launched without showing a black screen at any moment (instead, the previous activity is shown while the new […]

One application installed, show two entries in launcher

In Android, how to implement the following effect? Install just one application, but in the launcher, there are two entries, and entering each will go to different ui. Just like google map, you can see only one application, but there are map and navigation entries. Thanks.

Android: using getIntent() only within onCreate?

In Android (targeting APIs 14-16) I have a MainActivity and a NextActivity. There is no difficulty using intents to start NextActivity from within MainActivity if the getIntent() method is called inside the onCreate() block of NextActivity: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int data = 7; … Intent […]

Android – No Activity found to handle Intent { act=android.intent.action.VIEW – Trying to open a PDF File

I searched a lot to find a solution , but still can’t find any I am trying to open a PDF file in my android application Here is my code to do this : try { File file = new File(Environment.getExternalStorageDirectory()+”/pdf/Read.pdf”); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); Uri uri = Uri.fromFile(file); Log.d(“CheckingURI”, uri.toString()); intent.setDataAndType(uri, “application/pdf”); […]

Enable downgrade when installing apk using intent on Android 4.2+

Is possible to enable downgrade when installing apk using intent on Android 4.2+? I found out that it is possible, when installing app via command shell (using -d) adb install -r -d <link to apk>, so I hope it is somehow possible also via Intent. I was looking for some flag or something, but I […]

My app won't show up on the chooser dialog for android.intent.action.VIEW with mime type video/* only on Marshmallow

Basically when an app shares a video url my app is supposed to show up on the list but it doesn’t. Neither does MXPlayer but the Google Photos media player shows up fine as well as allcast (which had a recent release to fix this). I wrote a quick app to test this issue, here […]

How to create a custom lock screen widget (I just want to display a button)

I need to allow users to quickly capture an image using my app when the device is locked. I figure the quickest way for a user to do this is via a button/widget on the lock screen – although I’m not sure how to build this. Most references I’ve found have related to music playback […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.