android-intent

How to check if the device has Low Storage on Android Oreo API 26 and Above

不问归期 提交于 2020-12-29 13:23:08
问题 How can I check if the device has low storage on Android 8 Oreo. I saw in the Android Documentation that the Intent.ACTION_DEVICE_STORAGE_LOW is deprecated in API 26. This constant was deprecated in API level 26. if your app targets O or above, this broadcast will no longer be delivered to any BroadcastReceiver defined in your manifest. Instead, apps are strongly encouraged to use the improved getCacheDir() behavior so the system can automatically free up storage when needed. - Android

Telephonymanager.EXTRA_INCOMING_NUMBER is deprecated in API level 29

社会主义新天地 提交于 2020-12-26 18:38:24
问题 I am in situation where I need to identify incoming call phone number in Android but when using TelephonyManager.EXTRA_INCOMING_NUMBER android studio warning EXTRA_INCOMING_NUMBER is deprecated .I gone through the developers.android.com, it shows apps performing call screening should use the CallScreeningService API instead. But I can't figure out how to use CallScreeningService to get incoming call phone number. Anyone can help me? 回答1: As @Saurabh said, the new way to screen calls is

Is it possible to detect if an ACTION_SEND Intent suceeded?

故事扮演 提交于 2020-12-26 07:00:53
问题 I have a simple Android app with code like this (from the Android Documentation): Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to))); But I can't find a way to detect of the email was successfully sent (or the user cancels out). Is there a way to read an intent response? 回答1: Is

Is it possible to detect if an ACTION_SEND Intent suceeded?

和自甴很熟 提交于 2020-12-26 06:58:32
问题 I have a simple Android app with code like this (from the Android Documentation): Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to))); But I can't find a way to detect of the email was successfully sent (or the user cancels out). Is there a way to read an intent response? 回答1: Is

Use onNewIntent(…) in a fragment

走远了吗. 提交于 2020-12-15 06:48:09
问题 I have a problem. I want to use a the method onNewIntent(...) and getIntent(...) . Unfortunately the fragment do not know this intent. How can I use this method in my fragment? This fragment should be able to read an NFC tag, so I need the intent. I would be very happy to receive an answer. I thank you in advance. Below you can see my code. public class UserFragmentGeldaufladen extends Fragment { private Dialog epicDialog; private NfcAdapter nfcAdapter; private PendingIntent pendingIntent;

Use onNewIntent(…) in a fragment

故事扮演 提交于 2020-12-15 06:47:12
问题 I have a problem. I want to use a the method onNewIntent(...) and getIntent(...) . Unfortunately the fragment do not know this intent. How can I use this method in my fragment? This fragment should be able to read an NFC tag, so I need the intent. I would be very happy to receive an answer. I thank you in advance. Below you can see my code. public class UserFragmentGeldaufladen extends Fragment { private Dialog epicDialog; private NfcAdapter nfcAdapter; private PendingIntent pendingIntent;

Make phone call while app is in kiosk mode

生来就可爱ヽ(ⅴ<●) 提交于 2020-12-06 04:10:05
问题 We are working on an Android app which is intended to replace the default Android dialer and handle by itself all the calls going on in the device. So far, the app works as expected and we are able to both handle incoming calls and make calls by launching ACTION_CALL intents. However, this app is intended to be run in kiosk mode via Android Management API. Whenever we fire the ACTION_CALL intent, kiosk mode blocks it, although the app is set as default dialer. After some debugging we

Android- How to send data from activity to service?

旧巷老猫 提交于 2020-12-01 09:43:17
问题 In my application I'm trying to send data from my MainActivity.class to a service called bgservice.class . This is my following code: MainActivity.class: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent serviceIntent = new Intent(bgservice.class.getName()); serviceIntent.putExtra("UserID", "123456"); this.startService(serviceIntent); } bgservice.class: @Override public int onStartCommand(Intent intent, int flags, int startId) { String userID =

How to show a notification everyday at a certain time even when the app is closed?

*爱你&永不变心* 提交于 2020-11-30 06:45:51
问题 Although this question might have been asked before on Stack Overflow, I still haven't found a clear answer. I want to show a notification everyday at 12pm for example even when the app is closed. I have referenced from those links: Notifications in specific time every day android, Android daily repeating notification at specific time of a day using AlarmManager, Android BroadcastReceiver on startup - keep running when Activity is in Background and much more... I'm confused on the difference

Pick from Google Photos provider with ACTION_GET_CONTENT or OPEN_DOCUMENT

跟風遠走 提交于 2020-11-29 04:21:55
问题 I have no clue at why this happens, but I am not able to pick images from the Google Photos provider. Testing on API 27. With ACTION_GET_CONTENT If I use: val intent = Intent(Intent.ACTION_GET_CONTENT) intent.addCategory(Intent.CATEGORY_OPENABLE) intent.type = "image/*" I can see Google Photos among the provider I can browse to some picture and select it Then I am directed back to the providers list (not to my app), as if the provider had crashed in a try-catch When I open the Photos provider