android-intent

Scheduling more than one pendingIntent to same activity using AlarmManager

余生颓废 提交于 2020-01-03 17:29:53
问题 Recently I noticed strange behaviour when i tried to schedule Activities to be run in the future using AlarmManager. Look at the code below, the first activity is started in 20 seconds, while the second activity is not started in 40 seconds instead it is started only after 60 seconds. Can anyone explain why the second intent doesn't schedule the second activity to be called instead the third intent does. Does this mean that i can have only one intent for an activity in the AlarmManager. /

Scheduling more than one pendingIntent to same activity using AlarmManager

≯℡__Kan透↙ 提交于 2020-01-03 17:29:15
问题 Recently I noticed strange behaviour when i tried to schedule Activities to be run in the future using AlarmManager. Look at the code below, the first activity is started in 20 seconds, while the second activity is not started in 40 seconds instead it is started only after 60 seconds. Can anyone explain why the second intent doesn't schedule the second activity to be called instead the third intent does. Does this mean that i can have only one intent for an activity in the AlarmManager. /

Why is my BroadcastReceiver receiving ACTION_USER_PRESENT twice?

与世无争的帅哥 提交于 2020-01-03 17:22:37
问题 My application needs to make a toast when the user unlocks the screen, so I registered a BroadcastReceiver to pick up the intent ACTION_USER_PRESENT in the manifest, like so: <receiver android:name=".ScreenReceiver" > <intent-filter> <action android:name="android.intent.action.USER_PRESENT"/> </intent-filter> </receiver> And then I defined a class like this: package com.patmahoneyjr.toastr; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent

ZXING intent request code (identifying my intent)

╄→尐↘猪︶ㄣ 提交于 2020-01-03 17:13:57
问题 In my Android APP, whenever I need to call many different ActivitiesForResult from the same Activity, I do it like this: public void firstMethod() { int requestCode = 1; Intent intent = new Intent(SomeCode1.class); startActivityForResult(intent,requestCode); } public void secondMethod() { int requestCode = 2; Intent intent = new Intent(SomeCode2.class); startActivityForResult(intent,requestCode); } And to know which intent it came from, I recognize them like this: public void onActivityResult

Default when using multiple Actions in Intent-Filter

▼魔方 西西 提交于 2020-01-03 16:59:23
问题 Trying to grok intents and actions in android and looking through the documentation. But one thing I keep seeing is an intent filter with multiple actions defined. Like this, from the above link: <intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />

Is it OK to unregister 'dynamic' BroadcastReceiver from receiver's own onReceive() method?

微笑、不失礼 提交于 2020-01-03 15:32:51
问题 That is, I have this BroadcastReceiver I create on the fly to listen for one broadast, after which I want it to unregister itself. I haven't found any sample code that does it this way, but neither have I found any rule in the android online docs that forbids this. But I cannot let it hang around for as long as the activity, and it is in an anonymous class anyway, so the containing class does not even know the variable name. That is, the code looks something like this: myInfoReceiver = new

Is it OK to unregister 'dynamic' BroadcastReceiver from receiver's own onReceive() method?

99封情书 提交于 2020-01-03 15:32:34
问题 That is, I have this BroadcastReceiver I create on the fly to listen for one broadast, after which I want it to unregister itself. I haven't found any sample code that does it this way, but neither have I found any rule in the android online docs that forbids this. But I cannot let it hang around for as long as the activity, and it is in an anonymous class anyway, so the containing class does not even know the variable name. That is, the code looks something like this: myInfoReceiver = new

Unable to get intent filters from a package

只愿长相守 提交于 2020-01-03 15:30:17
问题 I want to list all the intent filters that are present in an package. I am trying to do it using PackageManager class. I have set the flag PackageManager.GET_INTENT_FILTERS while fetching the PackageInfo object. But I dont know how to use it. I was able to get all the info related to activites and receivers using the respective flags, but dunno how to proceed for intent-filters. Any ideas how to solve this issue? 回答1: Looks like intent filters are not exposed in the API and the flag

Android Intent: Send an email with attachment

拟墨画扇 提交于 2020-01-03 11:47:25
问题 I want to send send several files via eMail. I found this Android multiple email attachments using Intent but it does work and I don't get any error message. It just don't attach the files (I also tried to send just one file but I got the same result). Did I have overseen something.? Do you have any suggestions? private static void email (Context context, String emailTo, String emailCC, String subject, String emailText, List<String> filePaths) { //need to "send multiple" to get more than one

android opening facebook app on a specific post

笑着哭i 提交于 2020-01-03 11:01:14
问题 I am working on an application that fetches posts from user stream (from stream table) and displays them. streams post_id fields are returned in the format of: {uid}_{postid}, e.g.: 100001147753406_320951738012113 How can I open facebook application to show such post? in web browser this can be done with the url: www.facebook.com/uid/posts/postid, and according to searches this should be accomplished by setting Intent's uri to: fb://post/{postid}?owner={uid} However, this does not always work