android

Using webview and proxy with authentication

可紊 提交于 2021-02-18 12:07:04
问题 I need to load some url in WebView that is unavailable in one country, so I tried to use a proxy with WebView. I've found one solution on SO (https://stackoverflow.com/a/18453384/7478869), and it works with proxy without authentication. But I need to set the proxy with user and password. Some approaches, that didn't help: 1) Load url with headers class ProxyAuthWebViewClient extends WebViewClient { String proxyUserName; String proxyPassword; public ProxyAuthWebViewClient(String proxyUserName,

Using webview and proxy with authentication

≡放荡痞女 提交于 2021-02-18 12:03:12
问题 I need to load some url in WebView that is unavailable in one country, so I tried to use a proxy with WebView. I've found one solution on SO (https://stackoverflow.com/a/18453384/7478869), and it works with proxy without authentication. But I need to set the proxy with user and password. Some approaches, that didn't help: 1) Load url with headers class ProxyAuthWebViewClient extends WebViewClient { String proxyUserName; String proxyPassword; public ProxyAuthWebViewClient(String proxyUserName,

Android MediaPlayer: Play Audio Resource in Raw Based on URI

随声附和 提交于 2021-02-18 12:01:22
问题 The problem I am trying to solve is in an activity that needs to play back audio files. Most of the files will be user created (and saved into external storage), and therefore played with the following code (based on Google's example code): MediaPlayer mPlayer = new MediaPlayer(); mPlayer.setDataSource(filename); mPlayer.prepare(); mPlayer.start(); Some of the audio files, though, are going to be included with the app, are usually played with the following code: MediaPlayer mPlayer =

Notification Badges in Android O

╄→гoц情女王★ 提交于 2021-02-18 12:00:11
问题 Im testing with Google Nexus 5x with Android Oreo SDK.I cant find Notification Badges in App icon in Homescreen,even i got notification from App And app shortcut is not showing Number.The following is snippet: final NotificationManager mNotific=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); CharSequence name="Ragav"; String desc="this is notific"; int imp=NotificationManager.IMPORTANCE_HIGH; final String ChannelID="my_channel_01"; NotificationChannel mChannel=new

Notification Badges in Android O

安稳与你 提交于 2021-02-18 12:00:06
问题 Im testing with Google Nexus 5x with Android Oreo SDK.I cant find Notification Badges in App icon in Homescreen,even i got notification from App And app shortcut is not showing Number.The following is snippet: final NotificationManager mNotific=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); CharSequence name="Ragav"; String desc="this is notific"; int imp=NotificationManager.IMPORTANCE_HIGH; final String ChannelID="my_channel_01"; NotificationChannel mChannel=new

How to set encoder buffer size created by MediaCodec

狂风中的少年 提交于 2021-02-18 11:57:13
问题 I am trying to use Nexus to test encoding with Mediacodec APIs. I can see the inputBuffers provided by the encoder is 119040 (by logging inputBuffers.capacity). But the size of the frame, i.e. input, is 460800. I got error message at inputBuffer.put with buffer overflow . So I was about to set the input buffer to 460800. The API I could find is BufferInfo.set . However, I cannot find a way to attach this setting to the encoder. Could someone help? Thanks!!! encoder = MediaCodec

How to save nested List<String> in RoomDB on Android

我们两清 提交于 2021-02-18 11:47:06
问题 Hey google have an example on using @Relation @Entity public class Pet { int userId; String name; // other fields } public class UserNameAndAllPets { public int id; public String name; @Relation(parentColumn = "id", entityColumn = "userId") public List<Pet> pets; } Is it possible to save list of String without creating extra class for it. I want to avoid incosistence between my JsonProperty and a room Entity W would like to have soemthing like that public class UserNameAndAllPets {

React native check if tablet or screen in inches

霸气de小男生 提交于 2021-02-18 11:45:10
问题 I've established a different render logic for tablets and mobile devices. I was wondering if there is a way to get the screen size in inches or maybe even any module to automatically detect if the device is a tablet or not . The reason I am not using the dimensions api directly to get the screen resolution is that there are many android tablets with lower resolution than many of their mobile counterparts. Thanks. 回答1: Based on @martinarroyo's answer, a way to go about it use the react-native

Room: could I check passing value to query for NULL?

﹥>﹥吖頭↗ 提交于 2021-02-18 11:38:30
问题 I'm using Room libs, have DB Stations and want to execute query to get Stations with/without filter. UPD. I have DAO and I want to get all the records when my array (groupIds) is null or empty and get filtered list if I have at list one element in array. @Query("SELECT * FROM $STATIONS_TABLE_NAME WHERE ((:groupIds) IS NULL OR $GROUP_ID IN(:groupIds)) fun getStationsWithFilter(groupIds: IntArray?): Flowable<List<DbStation>> At this moment I had an issue 08-29 16:09:00.139 9508-9508/-

Filter log messages by PID or application package in Android

六月ゝ 毕业季﹏ 提交于 2021-02-18 11:37:25
问题 I understand that to filter Android log messages we can use something like adb logcat ActivityManager:I MyApp:D *:S But, in my application, I'm using different TAGS for different activities and I want to filter all the logs of this application only. What's the best way to do it? Do I need to specify all the tags in the command? Or using a common tag across the application, the only other alternative? While looking at log messages in Eclipse, I notice that there is a column named PID and