android-7.1-nougat

How to display image with intent.ACTION_VIEW

拈花ヽ惹草 提交于 2021-02-18 18:56:37
问题 My grammar can run at android 5.1 but is not working at android 7.1.... File file = new File(Environment.getExternalStorageDirectory(), "Pictures/1481853170451.jpg"); Toast.makeText(MainActivity.this, file.getPath(), Toast.LENGTH_LONG).show(); Uri path = Uri.fromFile(file); if (file.exists()) { Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(path, "image/*"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); try { this.startActivity

How to display image with intent.ACTION_VIEW

一曲冷凌霜 提交于 2021-02-18 18:56:23
问题 My grammar can run at android 5.1 but is not working at android 7.1.... File file = new File(Environment.getExternalStorageDirectory(), "Pictures/1481853170451.jpg"); Toast.makeText(MainActivity.this, file.getPath(), Toast.LENGTH_LONG).show(); Uri path = Uri.fromFile(file); if (file.exists()) { Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(path, "image/*"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); try { this.startActivity

Service not restarting using START_STICKY on devices above API Level 25(Nougat)

我们两清 提交于 2021-02-08 07:45:22
问题 I have got a service in my app which needs to be restarted after app removed from recent task list. Service restarts for API level 25 and below but not for 25 and above versions.Please help me with this issue and would like to know the best way to restart a service which is compatible to all OS versions. public class XMPPMainService extends Service { private static final String TAG = "XMPPMainService"; private static final int RECONNECT_TRY_INTERVAL_MS = 900; // 5 Seconds private

Missing Dialog Buttons under Android 7.1.1

孤者浪人 提交于 2020-02-02 02:18:07
问题 This is a picture of an AlertDialog that is shown within my app. It should have a deny and an accept button. As you can see it has not: I cannot reproduce this error as I dont have a phone with Android 7.1. The picture was taken on a Google Pixel and send to me. All other Android versions this App was tested upon did not encounter this bug. (Versions 4.1, 6.0.1) Here is code of the method creating the dialog: /** * Creates a 2 options dialog. * @param context * @param title headline of the

Job scheduler in android nougat is not running

六月ゝ 毕业季﹏ 提交于 2020-01-25 07:18:42
问题 I am trying to make job scheduler run after every 3 seconds but it doesnt work on android noughat. Here is my code. mJobScheduler = (JobScheduler) getSystemService( Context.JOB_SCHEDULER_SERVICE ); JobInfo.Builder builder = new JobInfo.Builder( 1, new ComponentName( getPackageName(), JobSchedulerService.class.getName() ) ); builder.setPeriodic(3000); builder.setRequiresDeviceIdle(false); builder.setPersisted(true); JobInfo j=builder.build(); mJobScheduler.schedule(j); Job Scheduling service

Job scheduler in android nougat is not running

假装没事ソ 提交于 2020-01-25 07:18:31
问题 I am trying to make job scheduler run after every 3 seconds but it doesnt work on android noughat. Here is my code. mJobScheduler = (JobScheduler) getSystemService( Context.JOB_SCHEDULER_SERVICE ); JobInfo.Builder builder = new JobInfo.Builder( 1, new ComponentName( getPackageName(), JobSchedulerService.class.getName() ) ); builder.setPeriodic(3000); builder.setRequiresDeviceIdle(false); builder.setPersisted(true); JobInfo j=builder.build(); mJobScheduler.schedule(j); Job Scheduling service

Pre-install some apps so they can be uninstalled without root by user

我的未来我决定 提交于 2020-01-14 10:15:51
问题 Can I (As an AOSP builder) pre install some apps so after burning on device, they can easily be uninstalled (like regular downloaded apps)? I am already familiar with system apps and priv-apps but as they lie in system partition they can not be removed! (only disabled in settings menu) P.S. I know huawei for example uses /system/delapp to install such apps. But I seek for a general way or for AMLogic platform specifically which I am working on! 回答1: You can do that by configuring your build

Android Nougat PhoneStateListener is not triggered

旧城冷巷雨未停 提交于 2020-01-11 05:26:07
问题 In Android (target 25) I have a background service and in onCreate function I have initialized a phone state listener. It works fine on Android versions that are before Nougat but in Nougat it doesn't work, even though the permissions are granted. public class Service extends IntentService { class PhoneListener extends PhoneStateListener { String TAG = getClass().getName(); @Override public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state,

Icon is not getting displayed in notification in Android nougat

蹲街弑〆低调 提交于 2020-01-10 02:29:42
问题 I researched about this and found out that addAction (int icon, CharSequence title, PendingIntent intent) is deprecated, so I used addAction (Notification.Action action) . In both the cases, icon cant be seen. NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.ic_share, "", pendingIntent).build(); notificationBuilder.addAction(action); The text seems to be working though, but I have left it blank, hence there is an empty space below the main image, where icon

Android 7.0 Not able to get list of files under “/” directory

不打扰是莪最后的温柔 提交于 2020-01-01 07:03:11
问题 Before Android 7.0, i was able to get list of files under "/" directory, but on Andorid 7.0 version i am getting null when i try t get list of files from "/" directory. Below is my code: File root = new File("/"); File[] files = root.listFiles(); 回答1: From android 7.0 they have applied more restrictions. Now you need to get access for individual directories. Check this link out for more information. 回答2: I was facing a similar issue with Android 7.0. Try using "/storage/emulated/0" instead of