android-intent

Adding custom headers on all browsers

我怕爱的太早我们不能终老 提交于 2020-08-27 19:31:17
问题 I am working on a application where i want to add headers to browser in android. Its working pretty fine on Google chrome. But this is not working on other available browsers like Firefox, UC browser, OperaMini, Dolphin Below is the code that i tried. Intent mIntent = new Intent(Intent.ACTION_VIEW,Uri.parse(URL)); Bundle bundle = new Bundle(); bundle.putString(Constants.REQUEST_HEADER_TOKEN, "token"); bundle.putString(Constants.REQUEST_HEADER_AUTH, "Basic bfjdslfs"); mIntent.putExtra(Browser

Turning off second SIM via adb shell/Tasker - using activities/intents

僤鯓⒐⒋嵵緔 提交于 2020-08-26 08:06:38
问题 I have a Xiaomi Mi6, which supports two SIMs. I need to figure out how I can switch the second SIM (SIM2) off outside business hours using Tasker. I've got as far as figuring out how to open the settings page for SIM2 with Tasker: Action: android.intent.action.MAIN Cat: Launcher Extra 1: subscription_id:1 Extra 2: slot_id:1 Package: com.android.phone Class: com.android.phone.settings.MultiSimInfoEditorActivity Target: Activity which brings up the settings page for SIM2, like so. However, I

Turning off second SIM via adb shell/Tasker - using activities/intents

心已入冬 提交于 2020-08-26 08:05:21
问题 I have a Xiaomi Mi6, which supports two SIMs. I need to figure out how I can switch the second SIM (SIM2) off outside business hours using Tasker. I've got as far as figuring out how to open the settings page for SIM2 with Tasker: Action: android.intent.action.MAIN Cat: Launcher Extra 1: subscription_id:1 Extra 2: slot_id:1 Package: com.android.phone Class: com.android.phone.settings.MultiSimInfoEditorActivity Target: Activity which brings up the settings page for SIM2, like so. However, I

How to open default gallery app with particular album or folder?

寵の児 提交于 2020-08-25 07:29:08
问题 Every example i found on net is opening gallery and get images from gallery as result. My need is i don't want result or images to my app. I just want to trigger gallery app with showing particular folder of images. My App Have separate folder to save images. i need to navigate users directly to that path. 回答1: Try this code. It will retrieve view pictures under storage/emulated/0/Pictures/AppPics You can change the file path according to your directory path. File sdDir = Environment

How to keep my android app alive in background for 24/7 continuous sensor data collection

你离开我真会死。 提交于 2020-08-22 06:28:59
问题 I have built an android app for collecting mobile and wearable sensor data. I want this app to be running in background 24/7 without being killed by OS. I am aware of all the pro and cons of running it 24/7 but that's my main business requirement. EDIT: I have made it as foreground service and it works as long as I keep interacting with my phone but if I keep it idle for let's say 4-5 hrs OS kill it despite being listed as foreground service 回答1: runing a background service after android

How to cancel alarm programmatically in android? [duplicate]

此生再无相见时 提交于 2020-08-20 07:17:08
问题 This question already has answers here : Android Alarm Clock - Remove alarms programmatically (2 answers) Closed 6 years ago . I used this code to create an alarm and it works. Please suggest how to cancel that alarm. Intent alarmIntent = new Intent(AlarmClock.ACTION_SET_ALARM); alarmIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); alarmIntent.putExtra(AlarmClock.EXTRA_MESSAGE, mEdtTitle.getText() .toString()); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, mTimePicker

Android return object as a activity result

可紊 提交于 2020-08-18 02:32:39
问题 Is it possible to return object as a activity result from child activity to parent? Just something like: Intent resultIntent = new Intent(null); resultIntent.putExtra("STRING_GOES_HERE", myObject); setResult(resultIntent); finish(); If it is possible, how should I retrieve myObject in parent activity? I figured out, that to retrieve data I need to do something like this: protected void onActivityResult (int requestCode, int resultCode, Intent data) { if(requestCode == REQ_CODE_CHILD) {

Android return object as a activity result

大憨熊 提交于 2020-08-18 02:29:53
问题 Is it possible to return object as a activity result from child activity to parent? Just something like: Intent resultIntent = new Intent(null); resultIntent.putExtra("STRING_GOES_HERE", myObject); setResult(resultIntent); finish(); If it is possible, how should I retrieve myObject in parent activity? I figured out, that to retrieve data I need to do something like this: protected void onActivityResult (int requestCode, int resultCode, Intent data) { if(requestCode == REQ_CODE_CHILD) {

Android return object as a activity result

我们两清 提交于 2020-08-18 02:29:12
问题 Is it possible to return object as a activity result from child activity to parent? Just something like: Intent resultIntent = new Intent(null); resultIntent.putExtra("STRING_GOES_HERE", myObject); setResult(resultIntent); finish(); If it is possible, how should I retrieve myObject in parent activity? I figured out, that to retrieve data I need to do something like this: protected void onActivityResult (int requestCode, int resultCode, Intent data) { if(requestCode == REQ_CODE_CHILD) {

How to keep a service alive using AlarmManager.setInexactRepeating()?

廉价感情. 提交于 2020-08-10 08:26:09
问题 I have some existing code that spawns a service intent which does a bunch of stuff in the background. This code does work... Intent serviceIntent = new Intent(context, APMService.class); serviceIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startService(serviceIntent); My question is: how to change this to use the AlarmManager.setInexactRepeating(...) methods? I have changed the above code to this: Intent serviceIntent = new Intent(context, APMService.class); serviceIntent.putExtra(