天道酬勤,学无止境

android-7.0-nougat

Android 7.0 Kills App Even When Foreground Service is Running

I have tried every suggestion I could find on the Internet to use Foreground Service to keep my app running beyond sleep and deep sleep modes but nothing has been successful so far. I am working on a taxi booking application. I designed it to start emitting driver's location to server whenever the driver turns himself Online and stop emitting when Offline. The following is the Foreground Service code that is started whenever driver turns himself Online and stopped when he presses online button which changes Common.CustomSocketOn to 0. It work fine during screen wake and also works when the

2021-09-23 17:56:47    分类:问答    android   android-7.0-nougat   foreground-service

Bluetooth Connection drops automatically with Android Application

I am creating an application which Connects with the BLE Device with android application programmatically. Here's my code for the Connect / Disconnect When user clicks on the Connect button new Thread(new Runnable() { @Override public void run() { mConnecting = true; mConnectException = null; mConnectWait.close(); // Reset the condition. if (mConnectedGatt != null) { // Reconnect to the BLE DEX adapter. Logger.d(LOG_TAG, "going to connect"); mConnectedGatt.connect(); BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(deviceAddress); device.connectGatt(mContext, false, mGattCallback); }

2021-09-23 16:12:18    分类:问答    android   bluetooth   bluetooth-lowenergy   android-7.0-nougat   bluetooth-gatt

Android 7.0 showing TextView Inflating error

My XML CODE:- <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp"> <TextView android:id="@+id/tvCollege" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:text="NGF\nCOLLEGE" android:textColor="@android:color

2021-09-07 03:49:25    分类:问答    java   android   textview   android-7.0-nougat   android-inflate

Is there a way to set a Quick Settings Tile's default state?

I'm messing around with the Quick Settings API in Android N / API 24, and while I think it's pretty well thought out, I can't seem to find a way to set a Tile's default state to Tile.STATE_ACTIVE... I've tried setting the state in my service's onCreate method, but the getQsTile() method seems to return null at times. Currently, I'm overriding onStartListening(), and am setting the state there, but this seems to cause a flickering effect most of the time. Is this just something that isn't possible yet, or am I missing something?

2021-09-05 16:47:27    分类:问答    android   android-7.0-nougat

How to upload selected video from nougat, path returning null

I want to upload video selecting from gallery. I am using Intent to select video from device: Intent intent = new Intent(); intent.setType("video/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Video"), PICK_VIDEO_REQUEST); after that: public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == REQUEST_TAKE_GALLERY_VIDEO) { Uri filePath = data.getData(); try { String[] projection = {MediaStore.Video.Media.DATA}; Cursor cursor = getContentResolver().query(filePath

2021-09-04 03:09:26    分类:问答    android   android-7.0-nougat

Z-order changed in activity transition animations on android 7.0 (nougat)?

I use custom animations for onBackPressed using @Override public void onBackPressed() { super.onBackPressed(); overridePendingTransition(R.anim.zoom_in, R.anim.slide_outto_right); } On Android 6.x the exit transition has the highest z-order, which means I can slide the leaving activity out while the "new" activity zooms in below it. Everythings fine on Marshmallow, but on Android 7.0 the z-order has reversed. Is anybody else experiencing this? Any fix suggestions?

2021-09-03 14:01:31    分类:问答    android   android-7.0-nougat

Permission Denial: writing android.support.v4.content.FileProvider uri

Good day.I have an weird issue to which none of examples in stack overflow has worked.I am opening an gallery,after which i am redirecting user to crop intent.Important to mention that this only happens on android N and not below devices.The issue is that this exception is thrown as soon as the crop is done..I dont know what causes this,but actually here is how i start crop intent. Intent cropIntent = new Intent("com.android.camera.action.CROP"); cropIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); Uri outPutUri = FileProvider.getUriForFile

2021-08-31 09:50:29    分类:问答    android   android-intent   crop   android-7.0-nougat   android-securityexception

Android - findViewById(Resources.getSystem().getIdentifier(“day”,“id”,“android”) not working

I was trying to show a datepicker with only month and year. Here's my code: Calendar todayDate = Calendar.getInstance(); android.app.DatePickerDialog pickerDialog = new android.app.DatePickerDialog( new ContextThemeWrapper(getContext(), android.R.style.Theme_Holo_Light_Dialog_NoActionBar), new android.app.DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int i, int i1, int i2) { updateDobButtonWithValue(button, i, i1, i2, sdfdisplay, sdfvalue, valuechangecallback); } }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar

2021-08-31 07:36:30    分类:问答    java   android   mobile   android-7.0-nougat

How to position a toast in Nougat's multi-window mode?

While using Nougat's new multi-window mode, I noticed that a Toast will be displayed over another app if my own app is in the top window in portrait mode. This is ... not good at all. So I tried positioning my Toast following this answer to "How to change position of Toast in Android?" toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0); Unfortunately the Gravity seems to be interpreted as "gravity for the screen" not "gravity for my window". How to get a Toast displayed somewhere near the bottom of my window and centered horizontally?

2021-08-11 11:31:30    分类:问答    android   android-toast   android-7.0-nougat

Unable to sign apk “with only the traditional scheme” even after setting 'v2SigningEnabled' as false

I updated my android-studio to latest stable version i.e. 'Android Studio 2.3' and also the gradle to 2.3.0. Now, when I am trying to generate a signed apk of my app's release build, this "extra" thing (Signature versions:) is getting shown in the last step: I clicked on 'Signature Help' and this page got opened. I followed the doc and made changes to my build.gradle file like this: apply plugin: 'com.android.application' //Put Fabric plugin after Android plugin apply plugin: 'io.fabric' android { signingConfigs { config { keyAlias 'xxxxxx' keyPassword 'xxxxxx' storeFile file('/Users/xxxxx')

2021-08-11 03:37:12    分类:问答    android   android-studio   android-7.0-nougat   android-7.1-nougat   android-studio-2.3