android-pendingintent

How to open image url on browser using android widget

 ̄綄美尐妖づ 提交于 2020-01-05 12:12:15
问题 How do i use intent in android widget to open images in browser. 回答1: If the image is on the internet it would be as simple as this: String url = "http://www.picturesnew.com/media/images/image-background.jpg"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); However if the image is inside of your assets you can't open it in the browser. That's because the browser accepts URI data that starts with http . Furthermore the browser is a separate app and one

Set different activities for pending intent of notification

好久不见. 提交于 2020-01-05 05:27:09
问题 I am currently facing the problem of setting pending action for two different activities to notification. I have a ParentActivity and a ChildActivity. I want open ChildActivity on notification click if currently it is running or paused, otherwise start ParentActivity. I tried this : ......... Intent resultIntent = new Intent(this, ChildActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(ParentActivity.class); stackBuilder.addNextIntent

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. /

singleTask and singleInstance not respected when using PendingIntent?

淺唱寂寞╮ 提交于 2020-01-02 06:38:08
问题 I have an activity with launchMode set to singleTask: <activity android:name="com.blah.blah.MyActivity" android:launchMode="singleTask"> </activity> I have an ongoing notification with a PendingIntent that launches that activity: Intent activityIntent = new Intent( this, MyActivity.class ); TaskStackBuilder stackBuilder = TaskStackBuilder.create( this ); stackBuilder.addParentStack( MyActivity.class ); stackBuilder.addNextIntent( activityIntent ); PendingIntent resultingActivityPendingIntent

Widget onUpdate is not setting pendingIntent on button click after reboot

∥☆過路亽.° 提交于 2020-01-02 05:13:10
问题 I'm creating a test widget that shows random number by clicking its button. everything is inside onUpdate of my Provider independently, including the pendingIntent . it works fine but after rebooting the phone views.setOnClickPendingIntent is not working although RemoteViews is recreated with no issue but the button becomes unresponsive. public class TestWidget extends AppWidgetProvider { static HashMap<Integer, BroadcastReceiver> br = new HashMap<>(); static void updateAppWidget(Context

Android O, Background Service is running for more than 30 minutes. Why?

微笑、不失礼 提交于 2020-01-01 11:37:12
问题 I am using FusedLocationProvider API to register some Geofences with PendingIntent, when my app gets started (app was manually killed to trigger this behavior) via Geofence event, I start a background service to do some work. In this Service I create a separate background thread to do some long running tasks and I acquire a wake-lock so that I am sure my tasks are completed. The Service keeps running for longer period of times (30 - 50 minutes) even though It shouldn't be. It shouldn't be

Android Widget stops working randomly

随声附和 提交于 2020-01-01 10:06:52
问题 I have been working with this problem for three days now and I've looked at every single question on here for an answer. I have a widget with a button on it and all I would like it to do is start a service everytime it is clicked. The problem is that the button stops working randomly. I can't recreate it at all and I have no idea what causes it. My service calls stopSelf(); but I have had this problem with a broadcast receiver also so I believe the problem to be in the widget and not in the

FusedLocationProvider using intentservice for background location update: location update does not work when pendingintent has a bundle added

旧街凉风 提交于 2020-01-01 07:04:31
问题 I have been looking for an answer for this question for a long time and no one seemed to have an answer. I am trying to subscribe to location updates, using Google's latest FusedLocationProviderAPI. I have followed tutorial online and it works by getting my location every now and then using intentservice triggered by requestLocationUpdates. Moving on, I try to add pass a custom class of object "User" to my intentservice. This custom class would allow me to upload the location to my server for

Android usb enumeration

混江龙づ霸主 提交于 2020-01-01 05:37:06
问题 I am writing an android USB host application for which I am trying to enumerate the devices connected with tablet. I follow the code in the android USB host documentation in the developer site. My code is as follows AndroidUSBActivity public class AndroidUSBActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); USBClass usb = new USBClass();