I am developing native android app using Eclipse, I add the following permission on Android Manifest
<uses-permission android:name="android.permission.CALL_PHONE" />
Then, I get the following message when I am trying to install the android app on my device:
Directly call phone numbers this may cost you money
could I do something to hide this message because I think this is not friendly for users? maybe i need to use another permission, which is the closer one with no permission is required?
I used the following code on my adapter:
public void onClick(View v) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse(PhoneCall));
v.getContext().startActivity(callIntent); }
});
You are welcome to remove the CALL_PHONE permission. Then the message will not appear when the app is installed. All permissions trigger installation warnings, not just CALL_PHONE.
Note that your app only needs the CALL_PHONE permission if you use stuff like the ACTION_CALL Intent. ACTION_DIAL can also be used to place phone calls, but since it allows the user to be involved, no permission is required.
EDIT
Use this format to specify the number and user will have only to click green button "Call".
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:0123456789"));
startActivity(intent);
Related
https://developer.android.com/preview/privacy/background-activity-starts
From this, it results that my payment app, which shows an Activity when a NFC transaction is performed, will not be able anymore to show anything to the user.
Has anyone have a clue what would be the new approach ?
Thanks!
I currently use the NFC service and it starts an Activity intent.
Intent intent = new Intent(mApplicationContext, PaymentActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
mApplicationContext.startActivity(intent);
The Activity should be shown. It works now, but from Android Q, it won't
According to the link, if you are having a HostApduService, then your app should work the same in Android Q.
If that is not your case, the simplest work around is to get "Draw over other apps" permissions. You can open activities if the app has been granted the SYSTEM_ALERT_WINDOW permission by the user. I have tested this and working.
Technically, you are showing something on top of other apps without user's interaction, so this might be the right way to go.
I have created a new application and every page has a share button on it and on clicking share button it captures the screenshot and makes it shares via intent and over clicking on share button it ask for permission and once given it works smoothly for other devices except Android 6 as even once given permission Android 6 asks for it again and again
The code I have used on every page
Manifest:<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
OnClick(View v) {
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},1);
SHARE();
}
This code is written in 5 pages a five-page am having five page News category and on clicking on share button it should ask for permission but once given it should not ask
The problem is that you are requesting permissions in that method. You need to check to see if permissions have been granted and only then request them.
See here for details https://developer.android.com/training/permissions/requesting
My code:
Button buton = (Button) findViewById(R.id.button);
buton.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent inte = getPackageManager().getLaunchIntentForPackage("com.whatsapp");
if (inte != null)
startActivity(inte);
else
toast.show();
You do not need any permission, you can just launch it through an intent.
Pay attention, in some cases this might lead to app being refused from the Store (If you invoke another app - like whatsapp - since it might not be fully permitted by whatsapp)
You need to verify if the activity of another app that you are willing to run is exported or not.
The launcher activity of whatsapp is surely exported so you probably don't need any permission.
I have an app that, due to lack of mobile data in all areas, uses phone connection to make a phone call. There is some important information on the screen in my app, so I want to place the call without leaving my app screen. Is there any way to do this?
Add the following permission in mainfest file
<uses-permission android:name="android.permission.CALL_PHONE" />
Use the below code to start calling
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "123456789" ));
startActivity(intent);
If you want to implement inside tha app read the tutorial which will help you alot
I am unable to start the Call activity. I get the following error:
android.content.ActivityNotFoundException: No Activity found to handle Intent
This is my code:
Intent iCall =new Intent(android.content.Intent.ACTION_CALL);
iCall.setData(Uri.parse(phoneNum));
startActivityForResult(iCall, Codes.Prefs.CALL_CODE);
The funny thing is that this should always work, because the android phone can always make a phone call, regardless of whether an app is installed or not, because making phone calls is built-in. Right?
Thanks!
Please use only one line of code :
startActivity(new Intent(Intent.ACTION_CALL,Uri.parse("tel:18004581552")));
with the permission in manifest file
android.permission.CALL_PHONE
In the manifest file for your application, make sure you have the permission:
<uses-permission android:name="android.permission.CALL_PHONE">
Also, your Intent should look more like this:
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);
did you give the permission in Android manifest file
<uses-permission android:name="android.permission.CALL_PHONE" />