android-intent

URL Scheme to open Chrome/Firefox (Android OS) from Facebook post

只谈情不闲聊 提交于 2020-06-17 14:16:40
问题 We've a web page that needs to be open in Chrome/Firefox on Android to fully display the content. But when we post the link on Facebook, it always opens the links with its own web browser. So we're checking if there is a way to force opening the link in Chrome browser from a Facebook post. Here are some approaches that we tried: Use Chrome URL Scheme (googlechrome://navigate?url=example.com) Use window.location.href, window.open (url,"_system"), etc And even using the intent to launch chrome

Permission Denial while sharing file with FileProvider

元气小坏坏 提交于 2020-06-11 04:04:26
问题 I am trying to share file with FileProvider. I checked that file is shared properly with apps like gmail, google drive etc. Even though following exception is thrown: 2019-08-28 11:43:03.169 12573-12595/com.example.name E/DatabaseUtils: Writing exception to parcel java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri content://com.example.name.provider/external_files/Android/data/com.example.name/files/allergy_report.pdf from pid=6005, uid=1000

Unable to instantiate receiver, java.lang.IllegalAccessException: access to class not allowed

青春壹個敷衍的年華 提交于 2020-06-08 17:28:30
问题 In the manifest I've declared the receiver element correctly to the best of my knowledge. But the Receiver never gets called when I send out the broadcast. The log cat shows. 07-22 23:51:49.181: E/AndroidRuntime(3799): FATAL EXCEPTION: main 07-22 23:51:49.181: E/AndroidRuntime(3799): java.lang.RuntimeException: Unable to instantiate receiver com.example.orderedbroadcastreceiver.HigherPriorityReceiver: java.lang.IllegalAccessException: access to class not allowed 07-22 23:51:49.181: E

Place a whatsapp video call

耗尽温柔 提交于 2020-06-07 06:09:54
问题 I use this code to send a plain whatsapp text message from my app: Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); sendIntent.setPackage("com.whatsapp"); startActivity(sendIntent); How can I perform a whatsapp video call from my application? 回答1: Assuming you already retrieved the contact number. Step1: you need to fetch the corresponding whatsapp contact id from

Place a whatsapp video call

送分小仙女□ 提交于 2020-06-07 06:09:01
问题 I use this code to send a plain whatsapp text message from my app: Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); sendIntent.setPackage("com.whatsapp"); startActivity(sendIntent); How can I perform a whatsapp video call from my application? 回答1: Assuming you already retrieved the contact number. Step1: you need to fetch the corresponding whatsapp contact id from

Place a whatsapp video call

一笑奈何 提交于 2020-06-07 06:07:05
问题 I use this code to send a plain whatsapp text message from my app: Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); sendIntent.setPackage("com.whatsapp"); startActivity(sendIntent); How can I perform a whatsapp video call from my application? 回答1: Assuming you already retrieved the contact number. Step1: you need to fetch the corresponding whatsapp contact id from

Creating intent in test: “Method putExtra in android.content.Intent not mocked”

落爺英雄遲暮 提交于 2020-05-30 07:20:23
问题 I'm trying to unit test a broadcast receiver which listens for "com.android.music.metachanged" intents using JUnit4 and Mockito. The broadcast receiver starts a service when it receives an intent. I want to assert that the service is started. I also want to assert that the string extra "artist" of the received intent is the same as the one of the sent intent. This is what I have so far... @RunWith(PowerMockRunner.class) public class MusicBroadcastReceiverUnitTest { private

Creating intent in test: “Method putExtra in android.content.Intent not mocked”

心已入冬 提交于 2020-05-30 07:19:22
问题 I'm trying to unit test a broadcast receiver which listens for "com.android.music.metachanged" intents using JUnit4 and Mockito. The broadcast receiver starts a service when it receives an intent. I want to assert that the service is started. I also want to assert that the string extra "artist" of the received intent is the same as the one of the sent intent. This is what I have so far... @RunWith(PowerMockRunner.class) public class MusicBroadcastReceiverUnitTest { private

Launch default SMS app without a message

谁都会走 提交于 2020-05-27 04:35:08
问题 I am wanting my app to, on a button click, launch the user's default texting app. The intention is not to have the user send a message, but to view their current text conversations, therefore I don't want it to launch the SMS app's "New Message" activity but instead the main app's activity itself. If I do the following: Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setData(Uri.parse("sms:")); context.startActivity(sendIntent); Then this is launched, instead I want it to

Launch default SMS app without a message

亡梦爱人 提交于 2020-05-27 04:34:11
问题 I am wanting my app to, on a button click, launch the user's default texting app. The intention is not to have the user send a message, but to view their current text conversations, therefore I don't want it to launch the SMS app's "New Message" activity but instead the main app's activity itself. If I do the following: Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setData(Uri.parse("sms:")); context.startActivity(sendIntent); Then this is launched, instead I want it to