android

Get list of all social media application installed in phone?

蹲街弑〆低调 提交于 2021-02-18 19:36:56
问题 I am developing an application which lists all application installed in users mobile. I retrieved all applications and I listed it in RecyclerView . Now I want to separate Social Media applications from that list for some other purposes. Is there any way to separate Social Media Apps ? I am using below code to retrieve all apps package names from phone. public List<String> GetAllInstalledApkInfo(){ List<String> ApkPackageName = new ArrayList<>(); Intent intent = new Intent(Intent.ACTION_MAIN

How to implement a Room LiveData filter

那年仲夏 提交于 2021-02-18 19:34:22
问题 I do not know how to implement a filter query properly inside the Repository and the ViewModel to use it to display the filtered string in a Textview or anything else really. My Entity, Dao, Repository, and ViewModel are as follows: User.kt @Entity(tableName = "user_data") data class User ( @PrimaryKey(autoGenerate = true) val id: Int, @ColumnInfo(name = "name") val name: String ) UserDao.kt @Dao interface UserDao { @Insert fun addUser(user: User) @Query("SELECT name FROM user_data WHERE name

Identify Call logs from Sim1 and Sim2

被刻印的时光 ゝ 提交于 2021-02-18 19:33:13
问题 I'm trying to show call logs from Sim1 and Sim2 separately. I'm getting all call logs, but not able to differentiate it whether it is from Sim1 or Sim2. I have tried below code, val managedCursor = activity?.contentResolver?.query(CallLog.Calls.CONTENT_URI, null, null, null, null) managedCursor?.let { val number = managedCursor.getColumnIndex(CallLog.Calls.NUMBER) val name = managedCursor.getColumnIndex(CallLog.Calls.CACHED_NAME) val type = managedCursor.getColumnIndex(CallLog.Calls.TYPE) val

How to send a request when push notification is cancelled in Android

本小妞迷上赌 提交于 2021-02-18 19:21:32
问题 When an application receives push notification from FCM , it calls onMessageReceived . (See 1, 2 or 3.) When a user taps the notification , it launches the applications, then it sends a request to a server that the user has read the notification. I want to know when a device received a push notification, but the user swiped it (or cleared all notifications). I want to send a request to the server that the user simply cancelled the notification . I tried to send BroadcastReceiver and show logs

Programmatically open app in split screen

时光总嘲笑我的痴心妄想 提交于 2021-02-18 19:19:21
问题 How do I open another app in a split screen in the android N (SDK 24)? In the documentation I found this: Launch New Activities in Multi-Window Mode When you launch a new activity, you can hint to the system that the new activity should be displayed adjacent to the current one, if possible. To do this, use the flag Intent.FLAG_ACTIVITY_LAUNCH_TO_ADJACENT. Passing this flag requests the following behaviour: If the device is in split-screen mode, the system attempts to create the new activity

Programmatically open app in split screen

笑着哭i 提交于 2021-02-18 19:19:12
问题 How do I open another app in a split screen in the android N (SDK 24)? In the documentation I found this: Launch New Activities in Multi-Window Mode When you launch a new activity, you can hint to the system that the new activity should be displayed adjacent to the current one, if possible. To do this, use the flag Intent.FLAG_ACTIVITY_LAUNCH_TO_ADJACENT. Passing this flag requests the following behaviour: If the device is in split-screen mode, the system attempts to create the new activity

Netflix in Android WebView

∥☆過路亽.° 提交于 2021-02-18 19:13:09
问题 So let me preface this by saying downloading the Netflix App is not an option. So my thought is to just make a wrapper app that loads the netflix website in a WebView. This works for login/navigation; however, whenever you hit the play button to start playing the video, there is no response and no output in logcat. I'm looking for a way to see more debug messages from the WebView or a way to get the video playing. Using Android 4.4.4 by the way. View layout = LayoutInflater.from(mActivity)

Netflix in Android WebView

别说谁变了你拦得住时间么 提交于 2021-02-18 19:12:28
问题 So let me preface this by saying downloading the Netflix App is not an option. So my thought is to just make a wrapper app that loads the netflix website in a WebView. This works for login/navigation; however, whenever you hit the play button to start playing the video, there is no response and no output in logcat. I'm looking for a way to see more debug messages from the WebView or a way to get the video playing. Using Android 4.4.4 by the way. View layout = LayoutInflater.from(mActivity)

Listening socket.io events and updating LiveData (a class of android.arch.lifecycle)in application class android

主宰稳场 提交于 2021-02-18 19:10:28
问题 I am working on a chat application and Currently I am listening and emitting socket events in an Activity. Now i want to listen all the socket events even when chat activity is not in foreground as i want to store all the messages from different users in the local DB at the same time i want to update LiveData to update UI. In order to achieve this I am listening socket events in the Application class as following: public class ChatApplication extends Application { public Socket mSocket;

Listening socket.io events and updating LiveData (a class of android.arch.lifecycle)in application class android

只谈情不闲聊 提交于 2021-02-18 19:09:57
问题 I am working on a chat application and Currently I am listening and emitting socket events in an Activity. Now i want to listen all the socket events even when chat activity is not in foreground as i want to store all the messages from different users in the local DB at the same time i want to update LiveData to update UI. In order to achieve this I am listening socket events in the Application class as following: public class ChatApplication extends Application { public Socket mSocket;