How to fix ussd code error? - android

My Logcat:
08-23 01:32:12.806 1299-1299/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.haftasia.easycode, PID: 1299
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxxxxx cmp=com.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{43f9a738 1299:com.haftasia.easycode/u0a181} (pid=1299, uid=10181) requires android.permission.CALL_PHONE
at android.os.Parcel.readException(Parcel.java:1472)
at android.os.Parcel.readException(Parcel.java:1426)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2109)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1419)
at android.app.Activity.startActivityForResult(Activity.java:3442)
at android.app.Activity.startActivityForResult(Activity.java:3403)
at android.app.Activity.startActivity(Activity.java:3645)
at android.app.Activity.startActivity(Activity.java:3613)
at com.haftasia.easycode.Day_3G_Mci$1$1.onClick(Day_3G_Mci.java:52)
at android.view.View.performClick(View.java:4448)
at android.view.View$PerformClick.run(View.java:18461)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5065)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)

You must add this permission in your AppManifest.xml:
<uses-permission android:name="android.permission.CALL_PHONE" />
Your error occurred because you didn't add it.

Since the logcat is saying everything what you looking for why dont you try to add permission ?
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>

You seem to have an intent which makes an call but however for any app to make a call it requires the permission.
To add it in the Manifest before the application tag add the following
<uses-permission android:name = "android.permission.CALL_PHONE"/>

Related

Difference between "Bookmark History" permission tag

What is the difference between the two Android permission below related to browser Bookmark History?
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/> -->
<uses-permission android:name="android.permission.READ_HISTORY_BOOKMARKS" />
My app works fine with the first one only, and crash with the second.
SDK version:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
Error Log when I use the second permission tag:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.SecurityException: Permission Denial: reading com.android.browser.provider.BrowserProvider2 uri content://browser/bookmarks from pid=5063, uid=10050 requires com.android.browser.permission.READ_HISTORY_BOOKMARKS, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1431)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:385)
at android.content.ContentResolver.query(ContentResolver.java:414)
at android.content.ContentResolver.query(ContentResolver.java:357)
at course.labs.permissionslab.BookmarksActivity.loadBookmarks(BookmarksActivity.java:56)
at course.labs.permissionslab.BookmarksActivity.access$000(BookmarksActivity.java:14)
at course.labs.permissionslab.BookmarksActivity$1.onClick(BookmarksActivity.java:32)
at android.view.View.performClick(View.java:4240)
at android.view.View$PerformClick.run(View.java:17721)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Android version: 4.3.1
Thanks!
This release removes support for global bookmarks. The android.provider.Browser.getAllBookmarks() and android.provider.Browser.saveBookmark() methods are now removed. Likewise, the READ_HISTORY_BOOKMARKS and WRITE_HISTORY_BOOKMARKS permissions are removed. If your app targets Android 6.0 (API level 23) or higher, don't access bookmarks from the global provider or use the bookmark permissions. Instead, your app should store bookmarks data internally.
https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-bookmark-browser

Mock Location permission issue on release app

I developed Fake GPS application and all my codes work nicely on debug mode.
When i try "mock location" on **release version**, i got this error;
java.lang.SecurityException: Requires `ACCESS_MOCK_LOCATION` permission
I already had ACCESS_MOCK_LOCATION in debug/AndroidManifest file.
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
And already "Allow Mock Location" checked in "Delevoper Options".
Finally; i cant add "ACCESS_MOCK_LOCATION" on main/AndroidManifest.xml. Android Studio dont approve this permission.
I tried on Samsung Note 3, V: 4.4.2
Whole of the expection;
java.lang.SecurityException: Requires ACCESS_MOCK_LOCATION permission
at android.os.Parcel.readException(Parcel.java:1472)
at android.os.Parcel.readException(Parcel.java:1426)
at android.location.ILocationManager$Stub$Proxy.addTestProvider(ILocationManager.java:944)
at android.location.LocationManager.addTestProvider(LocationManager.java:1205)
at egebit.getlocation.MapsActivity.mockLocation(MapsActivity.java:201)
at egebit.getlocation.MapsActivity$2.onClick(MapsActivity.java:118)
at android.view.View.performClick(View.java:4652)
at android.view.View$PerformClick.run(View.java:19311)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5692)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
In that case you are just adding for debug, but it's needed on release too.
You could add to Manifest(not debug) file with ignore value
<uses-permission
android:name="android.permission.ACCESS_MOCK_LOCATION"
tools:ignore="MockLocation" />

Error In Wifi Toggle Android Code

I get this error when I press the button for the wifi toggle and the app stops working.It mentions that the user has no permission to access wifi state.The thing is its already declared in the Manifest file.
Permissions used:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Error
FATAL EXCEPTION: main
Process: com.example.something.callblocker, PID: 935
java.lang.SecurityException: WifiService: Neither user 10052 nor current process has android.permission.ACCESS_WIFI_STATE.
at android.os.Parcel.readException(Parcel.java:1472)
at android.os.Parcel.readException(Parcel.java:1426)
at android.net.wifi.IWifiManager$Stub$Proxy.getWifiEnabledState(IWifiManager.java:808)
at android.net.wifi.WifiManager.getWifiState(WifiManager.java:1029)
at android.net.wifi.WifiManager.isWifiEnabled(WifiManager.java:1041)
at com.example.stamatis.callblocker.powersavings$2.onClick(powersavings.java:55)
at android.view.View.performClick(View.java:4438)
at android.widget.CompoundButton.performClick(CompoundButton.java:100)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
If this is happening and you are saying that android.permission.ACCESS_WIFI_STATE this is already present in manifest, then there is only one possibility that user has explicitly stopped this permission.
Check if this crash is in Marshmallow i.e API 23. Google has provided the user power to remove the permission of app explicitly.
You can read : http://www.greenbot.com/article/2990078/android/how-to-toggle-app-permissions-in-android-marshmallow.html
Only solution is to check for permission at runtime before doing toggle.
This is how you can do this :
private boolean checkWriteExternalPermission()
{
String permission = "android.permission.ACCESS_WIFI_STATE";
int res = getContext().checkCallingOrSelfPermission(permission);
return (res == PackageManager.PERMISSION_GRANTED);
}
Needs to be looked at by authorities for fraud and illegal activity steal the token page

Hide Installed app icon in android

I have a scenario in which i have to hide few installed apps icon i did try my best but didn't get the problem i think following code work for root devices only.
ComponentName componentToDisable =
new ComponentName("com.androidbird.lmkt",
"com.androidbird.lmkt.Splashscreen");
getPackageManager().setComponentEnabledSetting(
componentToDisable,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
Logcat:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidbird.lmkt/com.androidbird.lmkt.Splashscreen}: java.lang.SecurityException: Permission Denial: attempt to change component state from pid=18338, uid=10165, package uid=10140
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2377)
at android.app.ActivityThread.access$600(ActivityThread.java:167)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5341)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:929)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.SecurityException: Permission Denial: attempt to change component state from pid=18338, uid=10165, package uid=10140
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:2573)
at android.app.ApplicationPackageManager.setComponentEnabledSetting(ApplicationPackageManager.java:1250)
com.androidbird.dashboard.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:5125)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2289)
SecurityException: Permission Denial: attempt to change component state from pid=18338, uid=10165, package uid=10140
you cant hide other application ... for that you need root access... you can hide your app icon

RSS Feed app doesn't work

I'm working with android studio and when I launch the app it doesn't work and on android studio show this problem:
09-13 23:41:37.579 2228-2380/? A/SdkSpecific17﹕ null
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.google.android.location.os.real.SdkSpecific17.d(SourceFile:266)
at ees.run(SourceFile:797)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=2228, uid=10011 requires android.permission.INTERACT_ACROSS_USERS
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.getCurrentUser(ActivityManagerNative.java:3871)
at android.app.ActivityManager.getCurrentUser(ActivityManager.java:1948)
... 5 more
09-13 23:41:37.719 2228-2380/? A/SdkSpecific17﹕ null
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.google.android.location.os.real.SdkSpecific17.d(SourceFile:266)
at efb.D(SourceFile:933)
at dno.c(SourceFile:126)
at dno.x_(SourceFile:149)
at dnk.b(SourceFile:952)
at dmr.b(SourceFile:331)
at ees.run(SourceFile:798)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=2228, uid=10011 requires android.permission.INTERACT_ACROSS_USERS
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.getCurrentUser(ActivityManagerNative.java:3871)
at android.app.ActivityManager.getCurrentUser(ActivityManager.java:1948)
... 10 more
can you help me? Thanks
The clue is
Caused by: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=2228, uid=10011 requires android.permission.INTERACT_ACROSS_USERS
You need to add to your manifest.xml
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
That being said, I've not seen this permission before... I believe it's used when you require root access. So you also might need a phone that is rooted.

Categories

Resources