android-intent

how to add a dial number and press the `call` bottom?

末鹿安然 提交于 2021-02-05 12:20:51
问题 I want to trigger an intent that opens the dialer adds a number and then presses the call bottom. Is there any way to do the press bottom ? private void SendDialIntent() { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phone.phone)); startActivity(intent); } 回答1: You cannot "press the call button". You can use ACTION_CALL (instead of ACTION_DIAL ), which will directly place the phone call. This requires the CALL_PHONE permission and will not work for

how to add a dial number and press the `call` bottom?

亡梦爱人 提交于 2021-02-05 12:20:42
问题 I want to trigger an intent that opens the dialer adds a number and then presses the call bottom. Is there any way to do the press bottom ? private void SendDialIntent() { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phone.phone)); startActivity(intent); } 回答1: You cannot "press the call button". You can use ACTION_CALL (instead of ACTION_DIAL ), which will directly place the phone call. This requires the CALL_PHONE permission and will not work for

How to crop the image using four (x,y) coordinates

纵饮孤独 提交于 2021-02-04 05:00:11
问题 In my application ,I am going to crop the image using four (x,y) coordinates and also I need to show the cropped image in another activity screen. For example, In the below image, i want to crop the white layer itself. so any one provide the solution to accomplish this technique in my project. 回答1: Using an instance of the Bitmap class, you can use the Bitmap.creatBitmap(); method passing the original image x y (for the top left corner) and then width and height. see documentation here. in

How to switch to an existing activity, rather than start a new one

主宰稳场 提交于 2021-01-29 21:55:15
问题 I have a location service running and I want to alert the user if my main activity hasn't been active for several minutes, so from the service I am showing a notification with the code below (based on the example here), using a flag FLAG_ACTIVITY_REORDER_TO_FRONT instead of FLAG_ACTIVITY_NEW_TASK . But it always starts a new copy of the activity, rather than carrying on where the existing one left off. Intent resultIntent = new Intent(ctx, MainActivity.class); resultIntent.setAction(Intent

Start Gmail / Email Intent in Android showing list of emails

廉价感情. 提交于 2021-01-29 14:02:18
问题 I've implemented the firebase email link login, after generating the mail I want to open the phone's email app, so the user can directly open the mail, which was sent. fun startEmailApp(context: Context) { val emailPackage = "com.google.android.gm" val isGmailInstalled = isAppInstalled(context, emailPackage) val intent = Intent(Intent.ACTION_SEND) context.startActivity(Intent.createChooser(intent, "choose an email client")) if (isGmailInstalled) { intent.type = "text/html" intent.setPackage

Android content Uri cannot be played by other app

ⅰ亾dé卋堺 提交于 2021-01-29 09:15:22
问题 I used download manager to download a file to external storage. I set the destination to Download folder using request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName) After success I retrieve the uri with val fileUri=cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)) which gives me this file:///storage/emulated/0/Download/dishapatani_Jan%2007%2C%2008%3A07_1609986166669.mp4 Now I try to play this video file using intent with this val uri=Uri

Get SMS Delivery Report with in service

▼魔方 西西 提交于 2021-01-29 08:17:10
问题 I try to send sms when my mobile get rebooted.My code is working in activity,I can get the delivery report in activity.But I put the same code in Broadcastreceiver, It is not working. try { String SENT = "SMS_SENT"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { int resultCode = getResultCode(); switch (resultCode) { case Activity.RESULT_OK: Toast.makeText

Android: Opening a Word document using intents and FileProvider

只愿长相守 提交于 2021-01-29 07:29:21
问题 I am trying to open a word document (.doc and .docx) on Android from my app but I am getting a popup errors from the MS Word app: Can't open file | Try saving the file on the device and then opening it and the Google Docs app: Unable to open the document | We were unable to open your file The document is local and bundled with the app in the assets folder, and the chooser opens without catching any errors until the third party app tries to open the document. I am fairly certain there is an

Location not getting called from WorkManager

笑着哭i 提交于 2021-01-29 05:39:13
问题 I am using work manager to start location services, it loads doWork() method after every 15 minutes , but does not execute onLocationChanged . Before i was using Job Scheduler, and it was working just fine. The following code also works fine, if i display notification from Work Manager after 15 minutes. This is my code. public class LocationWorker extends Worker implements LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{ private static final

FireBase Authentication Auth State Changed

Deadly 提交于 2021-01-29 03:44:07
问题 I want to be able to pass an intent to an activity based on if the login state changes for the user i have to following AuthStateListener within the OnCreate method of the LoginActivity If the user is logged in then i want them to be forwarded to the MainActivity However if the user is logged out then they need to goto the LoginActivity The problem comes when they are signed out, it gets stuck in an infinite loop, constantly firing intent at the LoginActivity. Is there any way of telling