android-developer-api

Android Lollipop becoming device admininistrator doesn't work

可紊 提交于 2019-12-22 06:36:53
问题 I'm following this guide on how to have my app request to become a device administrator. This works great on any 4.x android versions with any phone, but doesn't work on Lollipop (I've tried on a Nexus 5 and on a Nexus 7). Logcat shoes the following error: *11-02 07:37:09.649: W/DeviceAdminAdd(10020): Cannot start ADD_DEVICE_ADMIN as a new task* Has anyone else come across this problem with Lollipop? What can be the cause? I've gone over all parts of the guide and made sure my XML, menifest,

How do I display a list of all MIME types supported by a given Android device?

一笑奈何 提交于 2019-12-22 00:52:31
问题 I'm trying to displaying a device supported format programmatically. i have found this on the internet. the question is, how to display those ? please help me, im newbie in Android development. Here is the code for checking file format of the device. package com.android.mmscommon; import java.util.ArrayList; public class ContentType { public static final String MMS_MESSAGE = "application/vnd.wap.mms-message"; // The phony content type for generic PDUs (e.g. ReadOrig.ind, // Notification.ind,

Android Q, programmatically connect to different WiFi AP for internet

醉酒当歌 提交于 2019-12-19 02:49:06
问题 As in Android Q, several WiFi APIs are restricted. I am trying to use alternate APIs to connect to different Wifi AP for internet. Below is my code : WifiNetworkSpecifier.Builder builder = new WifiNetworkSpecifier.Builder(); builder.setSsid("wifi-ap-ssid"); builder.setWpa2Passphrase("wifi-ap-password"); WifiNetworkSpecifier wifiNetworkSpecifier = builder.build(); NetworkRequest.Builder networkRequestBuilder1 = new NetworkRequest.Builder(); networkRequestBuilder1.addTransportType

How to use getCurrencyInstance and format in low api?

浪子不回头ぞ 提交于 2019-12-12 18:23:57
问题 I am getting an error in the following code: private void displayPrice (int number) { TextView price = (TextView)findViewById(R.id.txt_price); price.setText(NumberFormat.getCurrencyInstance().format(number)); } The error I am getting is as follows: Call requires API level 24 (current min is 14): android.icu.text.NumberFormat#getCurrencyInstance Android API 24 can use this. How can I use this in low API like API 15 ? 回答1: Change your import to use java.text.NumberFormat (available from API 1)

How to contact Google Development Team

浪尽此生 提交于 2019-12-12 06:46:35
问题 one of my apps was banned, how can I contact Google's development support team? I tried to contact them via the first email they sent to me but they didn't answer. Is there an email or a link to reach them? 回答1: Inside Google Play Console click on the question icon and then click on email. They will respond generally in 2-5 days. 来源: https://stackoverflow.com/questions/45898549/how-to-contact-google-development-team

Send data to arduino as long as the button is being pressed

为君一笑 提交于 2019-12-12 04:18:46
问题 I want to send data to an arduino mega 2560 as long as a button is being pressed and when that button is released it will stop sending informations. I am using onTouchListener with MotionEvent constants. But when I run this on my phone I press the button and it sends data even though after a while I release it. Where am I being wrong here? switch (v.getId()) { case R.id.left1: // check what button is pressed while(event.getAction() == MotionEvent.ACTION_DOWN) { bt.sendData("1"); // while

In android, is there any way to play an audio in just during call beeps before the call is picked up by other person?

ⅰ亾dé卋堺 提交于 2019-12-12 03:44:44
问题 In my android app, before a call is picked up, I want to just replace the call beeps with an audio file? and once the call is picked up, I would turn off my audio file. Please someone help me out in this issue! P.S: The purpose of this feature is just to replace the annoying call beeps before the receiver on the other end picks up the call. 回答1: This person is playing an audio file during the call, please follow the link, My streaming audio player continues to play during a phone call -

How to auto scroll up the chat messages (using recyclerview instead of listview) above the softkeypad whenever keypad pop ups?

青春壹個敷衍的年華 提交于 2019-12-11 04:27:27
问题 Like in chat applications whenever we want to send messages soft keypad pop ups which also auto scroll the last seen messages to top of the soft keypad provided that nothing is hidden behind the soft keypad. But in my case the keypad hides the conversations. How to fix this issue and I have used to recycler view for displaying the messages. I used android.support.v7.widget.RecyclerView 回答1: With RecyclerView you can achieve this as follows: LinearLayoutManager linearLayoutManager = new

App crashes with SecurityException on Android M [duplicate]

别说谁变了你拦得住时间么 提交于 2019-12-10 10:14:21
问题 This question already has answers here : Android 6.0 Permission Error (5 answers) Closed 4 years ago . Yesterday I set upped target and compile sdk to 23 API level. When I launched the app on Nexus 9 with Preview Android M (MPA441) the app crashes with following SecurityException : FATAL EXCEPTION: main Process: com.grouplogic.mobilecho, PID: 22554 java.lang.RuntimeException: Unable to create application com.mypackage.MyApplication: java.lang.SecurityException: getDeviceId: Neither user 10098

Install Apps from unknown sources inside work profile in Android Lollipop 5.0.1

僤鯓⒐⒋嵵緔 提交于 2019-12-08 03:56:41
问题 Question is related to Work Profile in " Android for work " . I have written a sample app that creates a managed work profile and sets itself as the profile owner . I will need to push some enterprise applications through the profile owner . So when i try to install , it says "Install blocked" , Cannot install from unknown sources . If i toggle the button ( Setting->security->Unknown Source ) on and off , settings are not getting reflected in the work profile. Is there a way to install the